2009-11-07 13 views
0

消息包含無效過期的安全上下文令牌或因爲綁定Web服務錯誤 - 消息無法處理。這很可能是因爲動作'不正確,或者是因爲

的問題是,在客戶端和服務器的時間之間的不匹配幾秒鐘後關閉。 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> 

回答

2

您可以配置自定義綁定模仿wsHttpBinding,可以讓你增加了安全設置maxClockSkew超出誤差範圍。見this article。太糟糕了,你不能直接在現有wsHttpBinding上做。

相關問題