Visual stdio.Net WCF的大小限制
基本上WCF在資料上的傳輸, 被限制在於只能使用可序列化的物件
其它像是arraylist, stringbulider...etc.等的object是不行的
(除非你可以把以上的物件全部轉為序列化物件), 而且又有大小的限制
相當的麻煩(其時也還好, 可能是筆者個人比較懶惰),
所以希望能夠將WCF的傳輸量放大的話需要更改web.config的檔案
原本的檔案如下:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
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>
</basicHttpBinding>
</bindings>
主要更改的是maxBufferSize="65536", maxReceivedMessageSize="65536"還有
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
這三個項目, 只要將此三個項目內的數字改成你想要的大小即可, 如下
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360000" maxBufferPoolSize="524288" maxReceivedMessageSize="655360000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="6553500" maxStringContentLength="2147483647"
maxArrayLength="6553500" maxBytesPerRead="6553500" maxNameTableCharCount="6553500" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
- Jan 06 Fri 2012 09:51
VS WCF輸傳限制
close
文章標籤
全站熱搜
留言列表