关于wcf返回二维数组的问题

haroun 2009-03-02 03:56:31
我用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>
...全文
69 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
建议你超过1m的传输量时用streamed模式

另外数组的index是int型的,是否超过了int的maxvalue?你22m有多少个项了呢?然后你把buffersize也设置的大些,看你没有设置,默认只有65536.
还有recievetimeout也要加大,22m,如果用http来连接,估计10分钟不够。

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧