关于wcf返回二维数组的问题
我用wcf返回二维数组,经测试在超过1500行数据时,就会抛出“基础连接已经关闭: 连接被意外关闭”的异常信息。经测试该返回值长度22M左右,但是我用DataSet作为结果返回到33M都没有问题。请问有谁知道其中的原因吗?我的配置文件是:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="LoaderServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:9001/" />
</behavior>
<behavior name="NewBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceTimeouts transactionTimeout="00:03:00" />
<dataContractSerializer maxItemsInObjectGraph="65536000" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="LoaderDualHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None"></security>
</binding>
</wsDualHttpBinding>
<basicHttpBinding>
<binding name="LoaderHttpBindingConfig" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="" name="IisServer.MyServer">
<!-- <endpoint binding="wsDualHttpBinding"
bindingConfiguration="LoaderDualHttpBindingConfig" name="IisServer.MyServer"
contract="contract.IContract" />-->
<endpoint binding="basicHttpBinding"
bindingConfiguration="LoaderHttpBindingConfig" name="IisServer.MyServer"
contract="contract.IContract" />
</service>
</services>
</system.serviceModel>
------解决方案--------------------
大容量数据传输,web.config修改方法
增加 <httpRuntime executionTimeout="900" maxRequestLength="102400" useFullyQualifiedRedirectUrl="false" />
这样试试
------解决方案--------------------
主要就是修改maxReceivedMessageSize、maxArrayLength,如果是在IIS里面host,那么需要同时修改web.config里面的
<httpRuntime maxRequestLength="73400" />