2012-05-09 6 views
1

Мы ставим перед собой безопасность на нашей таможне Binding, как показано ниже:Есть ли максимальная Time Stamp Срок действия Срок, когда клиент установлен в будущем DateTime против сервера

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

Извините, Яно, мне действительно нечего вносить, но ваш вопрос и ссылка напомнили мне об этом: http://xkcd.com/979/ –

+0

С другой стороны, возможно, 9 часов каким-то образом связаны с отношением вашего часового пояса к UTC или, возможно, к международной линии дат? –

+0

Возможно, клиент выдает исключение, когда получает ответ сервера, а не наоборот? проверьте использование wcf lossing. также опубликуйте полное исключение и его трассировку стека. –

ответ

1

Это истечение ключа сеанса, который отличается от метки времени. Например, вы отключите installSecurityContext (или не используете CreateSecureConversationSecurity), вы не должны получать это исключение.

В противном случае попытайтесь увеличить дополнительные значения, такие как InactivityTimeout, IssuedCookieLifetime, NegotiationTimeout, SessionKeyRenewalInterval и SessionKeyRolloverInterval.

Если вы включите трассировку WCF на сервере и увидите точную трассировку стека ошибки, возможно, мы сможем справиться с точным свойством.