调用Wcf服务,传输的数据量在哪设置?
遇到一个问题,调用服务时,传输的数据多一点时就会出错,从网上找了个篇都是同一个,
设置了一系列的maxXXX和httpRuntime后在调试的时候真有效,可是发布后还是有问题,请问还有哪里需要设置的?
[解决办法]
在web.config中设置wcf数据传输尺寸,例如:
使用basicBinding,代码如下:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IDataService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<bindings>
<customBinding>
<binding name="CustomBinding_IDataService">
<binaryMessageEncoding>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binaryMessageEncoding>
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
Dim httpTransportBinding As HttpTransportBindingElement = New HttpTransportBindingElement()
httpTransportBinding.MaxBufferSize = 2147483647
httpTransportBinding.MaxReceivedMessageSize = 2147483647
Dim binding As CustomBinding = New CustomBinding(New BinaryMessageEncodingBindingElement(), httpTransportBinding)