我們有一個WCF服務,它執行某些存儲過程並將結果返回給silverlight客戶端。一些存儲過程返回高達80K行。WCF服務中的緩衝區大小
下面給出的web.config中設置服務
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.MyServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_MyService"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
receiveTimeout="00:40:00" openTimeout="00:40:00"
closeTimeout="00:40:00" sendTimeout="00:40:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None"/>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="MyService.MyService.customBinding0">
<binaryMessageEncoding/>
<httpTransport/>
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="MyService.MyServiceBehavior"
name="MyService.MyService">
<endpoint name="BasicHttpBinding_MyService"
address=""
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_MyService"
contract="MyService.IMyService"/>
</service>
</services>
</system.serviceModel>
而這對於客戶
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<serviceBehaviors>
<behavior name="MyService_Behavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="r1">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_MyService"
closeTimeout="00:03:00" openTimeout="00:03:00"
receiveTimeout="00:10:00" sendTimeout="00:03:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8"
transferMode="Buffered" useDefaultWebProxy="true">
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_MyService"
address="http://localhost:8080/MyService/MyService.svc"
behaviorConfiguration="r1"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_MyService"
contract="MyService.IMyService" />
</client>
</system.serviceModel>
每當記錄數超越20K,服務拋出一個錯誤或者超時或NotFound。你爲什麼認爲這會發生?我該如何解決?
你確定你想從一個調用返回80K行?也許重構和使用「分頁」結果會更合適? – Jon 2011-03-17 09:57:50
我知道這聽起來很荒謬,但我的用戶很想將它顯示在網格上(當然,我們用分頁顯示它們)。大多數第三方網格像Telerik支持它雖然 – Kev 2011-03-17 09:57:59
你可以試着在multipe calls中獲取這些數據DownloadPage(1)... n你將得到所有的數據,但是以smaler塊 – kalvis 2011-03-17 10:00:58