我有一個ASP.Net網站,從WCF託管站點(IIS)獲取所有業務邏輯。有一段時間,它看起來像後端WCF凍結,並使網絡前端停止響應。我必須回收這兩個應用程序池才能使其再次運行。WCF停止響應interbitently
- 最近發生的情況更多,可能是因爲我們有更多&使用該網站的客戶。之前,它每月發生一次,現在每週發生一次。也許更多。
- 我們在每次SVC呼叫後關閉連接。在事件日誌接收
- 錯誤消息後我回收池
消息:System.ServiceModel.CommunicationException:在接收到HTTP響應時發生錯誤........... /.....BusinessServices.svc。這可能是由於服務端點綁定不使用HTTP協議。這也可能是由於HTTP請求上下文被服務器中止(可能是由於服務關閉)。查看服務器日誌獲取更多詳細信---> System.Net.WebException:底層連接已關閉:接收時發生意外錯誤。 ---> System.IO.IOException:無法從傳輸連接讀取數據:現有連接被遠程主機強制關閉。 ---> System.Net.Sockets.SocketException:
:一個現有的連接被強制由遠程主機的web應用程序的<bindings> <wsHttpBinding> <binding name="WSHttpBinding_IBusinessServices" closeTimeout="00:31:00" openTimeout="00:31:00" receiveTimeout="00:10:00" sendTimeout="00:31:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="999" maxStringContentLength="2147483647" maxArrayLength="1638400" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <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" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://localhost:8890/MyBusinessServices.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBusinessServices" contract="MyBusinessServices.IBusinessServices" name="WSHttpBinding_IBusinessServices" /> </client>
- Web.config中關閉
WCF服務的Web.config,將節流設置爲1500
.....
<behavior name="AppServiceBehaviors"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <serviceTimeouts transactionTimeout="00:15:00" /> <serviceThrottling maxConcurrentCalls="1500" maxConcurrentSessions="1500" maxConcurrentInstances="2147483647" /> </behavior> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> </serviceBehaviors> </behaviors>
這個問題是間歇性的,但它讓我發瘋。任何想法/建議表示讚賞。
埃裏克