2012-05-09 39 views
1

我們設置我們的安全對我們的自定義如下綁定的服務器的最大時間戳有效期限:是否有當客戶端設置爲將來的日期時間VS

var lSecurity = lCustomBinding.Elements.Find<TransportSecurityBindingElement>(); 
       lSecurity.LocalClientSettings.DetectReplays = false; 
       lSecurity.LocalServiceSettings.DetectReplays = false; 
       lSecurity.LocalClientSettings.TimestampValidityDuration = TimeSpan.FromDays(7); 
       lSecurity.LocalServiceSettings.TimestampValidityDuration = TimeSpan.FromDays(7); 
       lSecurity.LocalClientSettings.MaxClockSkew = TimeSpan.FromDays(7); 
       lSecurity.LocalServiceSettings.MaxClockSkew = TimeSpan.FromDays(7); 

現在我們發現,如果我們測試上述通過將客戶端從現在開始設置回7天,它就可以工作。但是,當我們將客戶端設置爲未來9小時以上時,我們會得到一個例外。

我們發現,在另一個線程結束一些模糊的參考的唯一的事:

http://social.msdn.microsoft.com/Forums/en/wcf/thread/7c3a7a7e-b9a5-4198-9a29-c6d4e408d36d

沒有任何人有什麼想法?

更新: 我們得到的異常現在添加到下面。似乎服務器拒絕客戶端消息:

System.ServiceModel.Security.MessageSecurityException occurred 
    Message=An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. 
    Source=mscorlib 
    StackTrace: 
    Server stack trace: 
     at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout) 
     at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout) 
     at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) 
     at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed) 
     at System.IdentityModel.Selectors.SecurityTokenProvider.RenewToken(TimeSpan timeout, SecurityToken tokenToBeRenewed) 
     at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.RenewKey(TimeSpan timeout) 
     at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.SecureOutgoingMessage(Message& message, TimeSpan timeout) 
     at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurityDuplexSessionChannel.Send(Message message, TimeSpan timeout) 
     at System.ServiceModel.Channels.ClientReliableChannelBinder`1.DuplexClientReliableChannelBinder`1.OnSend(TDuplexChannel channel, Message message, TimeSpan timeout) 
     at System.ServiceModel.Channels.ReliableChannelBinder`1.Send(Message message, TimeSpan timeout, MaskingMode maskingMode) 
     at System.ServiceModel.Channels.SendReceiveReliableRequestor.OnRequest(Message request, TimeSpan timeout, Boolean last) 
     at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout) 
     at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout) 
     at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout) 
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
     at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) 
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
     at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) 
     at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) 
     at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) 
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 
    Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
     at CompuLoan.Maintenance.IMaintenanceService.IsLicensed(String pHardwareId, Boolean pUseLicense) 
     at CompuLoan.Maintenance.MaintenanceServiceClient.IsLicensed(String pHardwareId, Boolean pUseLicense) in C:\Development\compuloan\Source\CompuLoan\Service References\Maintenance\Reference.cs:line 5156 
     at CompuLoan.App.IsLicensed(Boolean pUseLicense) in C:\Development\compuloan\Source\CompuLoan\App.xaml.cs:line 365 
    InnerException: System.ServiceModel.FaultException 
     Message=The security context token is expired or is not valid. The message was not processed. 
     InnerException: 
+1

對不起,Jano,我真的沒有什麼可以貢獻的,但是你的問題和鏈接讓我想起了這個:http://xkcd.com/979/ –

+0

第二個想法,或許9小時與你的時區的關係有某種聯繫到UTC,或可能是國際日期? –

+0

也許客戶端在獲取服務器響應時拋出異常,而不是其他方式?使用wcf損失檢查。也請發佈完整的異常和它的堆棧跟蹤。 –

回答

1

這是會話密鑰的到期日期,與時間戳不同。例如,你關閉establishSecurityContext(或不使用CreateSecureConversationSecurity),你不應該得到這個異常。

否則,請嘗試增加其他值,例如InactivityTimeout,IssuedCookieLifetime,NegotiationTimeout,SessionKeyRenewalInterval和SessionKeyRolloverInterval。

如果您打開服務器上的WCF跟蹤並查看錯誤的確切堆棧跟蹤,也許我們可以鑽取到確切的屬性。

相關問題