错误...安全时间戳无效,因为其创建时间在将来...在wcf中 [英] Error ...The security timestamp is invalid because its creation time is in the future...in wcf
问题描述
我使用wsHttpBinding使用wcf服务,然后遇到以下错误
安全时间戳无效,因为它的创建时间("2014-11-05T06:23:30.868Z")在将来.当前时间为"2014-11-05T06:17:07.406Z"并允许时钟偏斜为"00:05:00"."
在配置文件中使用此代码
< wshttpbinding>
< binding name ="WSHttpBinding_IPatientService" closetimeout ="00:01:00">
openTimeout ="00:01:00" receiveTimeout ="00:10:00" sendTimeout ="00:01:00"
绕过ProxyProxyOnLocal ="false" transactionFlow ="false" hostNameComparisonMode ="StrongWildcard"
maxBufferPoolSize ="524288" maxReceivedMessageSize ="65536"
messageEncoding =文本" textEncoding ="utf-8" useDefaultWebProxy ="true"
allowCookies ="false">
< readerquotas maxdepth ="32" maxstringcontentlength ="8192" maxarraylength ="16384">
maxBytesPerRead ="4096" maxNameTableCharCount ="16384"/>
< reliablesessionordered ="true" inactivitytimeout ="00:10:00">
enabled ="false"/>
<安全模式=消息">
< transport clientcredentialtype ="Windows" proxycredentialtype ="None"> realm ="/>
< message clientcredentialtype ="Windows" negotiationservicecredential ="true">
algorithmSuite =默认"/>
< client>
< endpoint address ="http://172.16.4.118/HIS.PatientService/PatientService.svc">
binding ="wsHttpBinding" bindingConfiguration ="WSHttpBinding_IPatientService"
contract ="PatientService.IPatientService" name ="WSHttpBinding_IPatientService">
< identity>
< dns value ="localhost">
I consume wcf service with wsHttpBinding then i face following error
"The security timestamp is invalid because its creation time (''2014-11-05T06:23:30.868Z'') is in the future. Current time is ''2014-11-05T06:17:07.406Z'' and allowed clock skew is ''00:05:00''."
Use this code in config file
<wshttpbinding>
<binding name="WSHttpBinding_IPatientService" closetimeout="00:01:00">
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliablesession ordered="true" inactivitytimeout="00:10:00">
enabled="false" />
<security mode="Message">
<transport clientcredentialtype="Windows" proxycredentialtype="None"> realm="" />
<message clientcredentialtype="Windows" negotiateservicecredential="true">
algorithmSuite="Default" />
<client>
<endpoint address="http://172.16.4.118/HIS.PatientService/PatientService.svc">
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPatientService"
contract="PatientService.IPatientService" name="WSHttpBinding_IPatientService">
<identity>
<dns value="localhost">
推荐答案
当服务绑定具有安全绑定元素并且客户端/服务器时钟的差大于允许的值(默认值为5分钟)时,将发生此异常.在您的情况下,它们似乎相距约5英寸16英寸.您可以考虑采用两种替代方法来解决此问题:
-确保客户端和服务器时钟更同步(如果它们可以访问公用的网络时间服务器,则可以使用网络时间"命令进行帮助)
-增加允许的偏斜.此设置不适用于标准绑定,您必须将其转换为自定义绑定并在安全绑定元素上更新此值.
并且由于您是通过config定义绑定的,因此添加以下内容:
Hi,
This exception occurs when the service binding has a security binding element, and the difference of the client/server clocks is larger than the allowed value (the default is 5 minutes). In your case it seems like they are apart by about 5''16". There are two alternatives you can consider to solve this problem:
- Make sure that the client and server clocks are more in sync (if they have access to a common network time server, a "net time" command should help)
- Increase the allowed skew. This setting is not available on standard bindings, you''d have to convert it to a custom binding and update this value on the security binding element.
And since you''re defining the binding via config, add this:
<bindings>
<custombinding>
<binding name="MaxClockSkewBinding">
<textmessageencoding />
<security>
<localclientsettings maxclockskew="00:10:00" />
<localservicesettings maxclockskew="00:10:00" />
<secureconversationbootstrap />
</security>
<httptransport />
</binding>
</custombinding>
</bindings>
希望这可以帮助 !! :)
问候,
Praneet
Hope this helps !! :)
Regards,
Praneet
这篇关于错误...安全时间戳无效,因为其创建时间在将来...在wcf中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!