简体   繁体   English

使服务返回大量数据

[英]make the service return large amount of data

What's the limit of data that I can return by WCF service? WCF服务可以返回的数据限制是多少? I tried to play around with maxReceivedMessageSize and other parameters but still dont know what exactly the limit? 我尝试使用maxReceivedMessageSize和其他参数,但是仍然不知道限制到底是什么? Even if I get rid of "size quota for incoming messages" issue I get "an existing connection was forcibly closed by the remote host". 即使摆脱了“传入邮件的大小配额”问题,我也得到“远程主机强行关闭了现有连接”。

I know that "pagging" is the best solution but at the moment I want to know what's MAX of data I can send to the client without additional complexity. 我知道“固定”是最好的解决方案,但此刻我想知道我可以发送给客户端的最大数据量是什么,而不会增加额外的复杂性。 Thanks! 谢谢!

Regards, Leonid 问候,Leonid

There are two places you have to edit: check this http://forums.silverlight.net/forums/t/40770.aspx 您必须编辑两个地方:选中此http://forums.silverlight.net/forums/t/40770.aspx

  1. edit the ServiceReferences.ClientConfig to accept a large buffer. 编辑ServiceReferences.ClientConfig以接受大缓冲区。

    binding name="BasicHttpBinding_MosaicService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 绑定名称=“ BasicHttpBinding_MosaicService” maxBufferSize =“ 2147483647” maxReceivedMessageSize =“ 2147483647”>

  2. on the server in the web.config 在web.config中的服务器上

add a Httpbinding and name it 添加一个Httpbinding并命名

which setts it to 2MB and tell the service to use this binding 将其设置为2MB并告诉服务使用此绑定

<services>

     <service behaviorConfiguration="TekPlayground.MosaicServiceBehavior"
name="TekPlayground.MosaicService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="ServicesBinding" contract="TekPlayground.MosaicService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

There are a lot of settings that influence the amount of data you can send/receive before limits are exceeded. 有许多设置会影响在超出限制之前可以发送/接收的数据量。

  • The service binding's maxReceivedMessageSize setting; 服务绑定的maxReceivedMessageSize设置;
  • The service binding's maxStringContentLength setting; 服务绑定的maxStringContentLength设置;
  • The service binding's maxArrayLength setting; 服务绑定的maxArrayLength设置;
  • The service behavior's maxItemsInObjectGraph setting. 服务行为的maxItemsInObjectGraph设置。

And, if you're hosting in IIS: 而且,如果您在IIS中托管:

  • ASP.NET's maxRequestLength ; ASP.NET的maxRequestLength ;
  • IIS' maxAllowedContentLength (under security/requestFiltering/requestLimits ). IIS的maxAllowedContentLength (在security/requestFiltering/requestLimits )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM