对于我的应用程序中的几乎所有(安全)WCF服务端点,如果客户端的系统时钟在未来或过去设置得太远,我会从WCFs Clock Skew机制中获得异常(在此描述:http://www.danrigsby .com/blog/index.php/2008/08/26/changing-the-default-clock-skew-in-wcf /).
但是,实现我的Login()方法的一个端点永远不会抛出此异常,即使它启用了传输安全性(当然也不需要凭据).
为什么"时钟偏差机制"不适用于此端点?也许是因为clientCredentialType设置为"None"?
举个例子,这是我的配置的简化版本:
<services>
<service name="Foo">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="binding1"
contract="IFoo" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="binding1" maxReceivedMessageSize="100000000">
<readerQuotas maxDepth="1000000000" maxArrayLength="1000000000" maxStringContentLength="1000000000" />
<security mode="Transport">
<transport clientCredentialType ="None"/>
</security>
<reliableSession enabled="false" />
</binding>
</wsHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
安全模式 - security mode="Transport" - 消息中不包含时间戳,这会导致 MaxClockSkew 验证忽略消息并且不会引发安全异常。将安全模式更改为安全模式 =“TransportWithMessageCredential”,其中包括时间戳并允许 MaxClockSkew 验证来测试消息的时间增量。
归档时间: |
|
查看次数: |
1340 次 |
最近记录: |