如何使WCF服务服务器 – 客户端时差独立?

从测试客户端访问WCF服务时,我遇到以下exception:

System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: An error occurred when verifying security for the message. --- End of inner exception stack trace --- 

我在网上搜索了这个问题的根本原因。 我发现这主要是由于客户端 – 服务器时间差异造成的。 但我无法找到正确的解决方案。 以下是我的服务器端配置:

                                   

和客户端配置:

                  

有人请帮我找到解决这个问题的方法。

更新:当我跟踪exception时,内部exception显示此The security timestamp is stale because its expiration time ('2013-08-21T11:17:39.482Z') is in the past. Current time is '2013-08-21T12:31:31.897Z' and allowed clock skew is '00:05:00'. The security timestamp is stale because its expiration time ('2013-08-21T11:17:39.482Z') is in the past. Current time is '2013-08-21T12:31:31.897Z' and allowed clock skew is '00:05:00'.

我的服务器使用UTC格式,我的客户端是一个通用应用程序,可以从任何国家/地区下载。

更新2:回答后配置:

                                  <!--   -->            <!--    -->  

此错误可能有多种原因,常见的原因与服务器没有因variosu原因而validation客户端有关(可能不在同一个域中)。 要确定确切的原因,请打开wcf跟踪并查看它以红色显示的错误。 你正在寻找的是在跟踪UI中有点隐藏的inenrexception,它位于树中间的右侧。

以下是设置时钟偏差的方法:

         

注意倾斜只能在自定义绑定上定义。 由于您使用WSHttpBinding,您需要将其转换为自定义绑定,可以通过WCF绑定转换器在线轻松完成。

我有同样的问题,并遵循所有建议。 但我的错是我只更改了服务器配置,而我也必须更改客户端配置。

这是我没有maxClockSkew的配置

    

并通过时钟偏差更新