![](/img/trans.png)
[英]Configuring WCF client gives the error "The message could not be processed. This is most likely because the action
[英]Web Service error - The message could not be processed. This is most likely because the action '' is incorrect or because
该消息包含无效的过期安全上下文令牌,或者因为绑定之间不匹配
问题是,客户端和服务器时间缩短了几秒钟。 除非在客户端/服务器关闭的几秒钟内进行呼叫,否则所有Web服务都可以正常工作。 因此,如果进行了呼叫,并且客户时间是6:00:58,服务器时间是6:01:01,则会发生上述错误。
我添加了代码来捕获异常,然后再次尝试调用,但始终收到此消息。
我已经同步了客户端/服务器上的时间,但是最终它们不同步了几秒钟。
有人有什么想法吗?
这是重要的Web配置的一部分(客户端/服务器之间的所有内容都相同):
<service behaviorConfiguration="WebServiceBehavior" name="WebService.TestService">
<endpoint
address=""
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_Service"
contract="WebService.ITestService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="./WebService/TestService/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_Service" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="1000000" maxReceivedMessageSize="1000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="false" allowCookies="false">
<readerQuotas maxDepth="900000" maxStringContentLength="900000" maxArrayLength="900000" maxBytesPerRead="900000" maxNameTableCharCount="900000" />
<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" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WebServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<customErrors mode="On" />
<identity impersonate="false" />
<authentication mode="Forms" />
</system.web>
您可以配置模仿wsHttpBinding
的自定义绑定,使您可以将安全性设置上的maxClockSkew
增加到错误范围之外。 看到这篇文章 。 不幸的是,您不能直接在现有的wsHttpBinding
上执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.