我有一個長期以來基於WCF的過程。如果有任何幫助,WCF服務將在Azure中運行。我認爲問題已經做超時:WCF超時問題?
1)的WinForms客戶端的結合部分下面的.config設置:
<wsHttpBinding>
<binding name="XXX" closeTimeout="00:05:00" openTimeout="00:05:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="10000000" maxReceivedMessageSize="10000000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="255" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false"/>
</security>
</binding>
</wsHttpBinding>
2)WCF服務在web.config中的下列綁定區段
<wsHttpBinding>
<binding name="XXX" maxReceivedMessageSize="10000000" sendTimeout="00:10:00" receiveTimeout="00:10:00" closeTimeout="00:10:00" openTimeout="00:10:00">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" establishSecurityContext="false" />
</security>
<readerQuotas maxArrayLength="2000000" maxBytesPerRead="10000000" maxStringContentLength="10000000" maxDepth="255" />
</binding>
</wsHttpBinding>
3)我有一個長期運行的WCF方法(通常2分鐘)。客戶端調用該方法,那些執行時間超過1分鐘的方法將拋出異常。這是最內部異常:
<InnerException>
<Type>System.Net.Sockets.SocketException</Type>
<Message>An existing connection was forcibly closed by the remote host</Message>
<StackTrace>
<Frame>at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)</Frame>
</StackTrace>
</InnerException>
</InnerException>
4)WCF調用本身成功完成,但(我都開始/結束登錄服務器端)。我如何避免異常?
謝謝!
任何時候需要一分鐘時間才能運行,它將返回錯誤。一分鐘後,錯誤就會返回給客戶端。但是服務器仍然正在完成方法調用。 – Igorek 2011-02-01 04:50:23