在用到WCF通訊的項目中,在將業務邏輯服務器內存中的數據,傳輸至ERP界面的顯示,以后在查詢服務器上的數據時,避免進入KVM出現的卡殼現象。已將服務器內存數據全部提供服務讓ERP進行調用,所有數據都可以,但是在駕駛員數據(7000以上)和注冊的設備ID數據(3000)以上,兩者數據請求出現遠程主機強迫關閉了一個現有的連接的問題,數據量一大則出現此種情。經過多次資料查詢,解決了此問題,進行記錄,以防再次有類似情況
服務器端配置
maxBufferSize與maxReceivedMessageSize設大數據值“2147483647”
<basicHttpBinding> <binding name="BasicHttpBindingConfig" receiveTimeout="00:00:30" sendTimeout="00:00:30" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" /> </basicHttpBinding> 其次,將MaxItemsInObjectGraph值設大
<behavior name="BasicHttpBehavior"> <serviceThrottling maxConcurrentSessions="10000" maxConcurrentInstances="1000" maxConcurrentCalls="1000" /> <serviceDebug includeExceptionDetailInFaults="false" /> <serviceMetadata httpGetEnabled="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> 再次即設置客戶端配置項
將maxItemsInObjectGraph設大 <behaviors> <endpointBehaviors> <behavior name="BasicHttpBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </endpointBehaviors> </behaviors> 同樣將maxBufferSize與maxReceivedMessageSize設大數據值“2147483647”
<binding name="BasicHttpBinding_IHandleWeb" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="5242880000" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding>