Max在WCF中收到了消息大小 [英] Max received mesage size in WCF

查看:90
本文介绍了Max在WCF中收到了消息大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我开发了WCF服务,返回文件的字节。



但是如果文件大小超过40 MB则会给我错误



异常消息:接收到http:// localhost的HTTP响应时发生错误: 56198 / Service.svc.This可能是由于服务端点绑定不使用HTTP协议。这也可能是由于服务器中止HTTP请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志。



内部异常消息:基础连接已关闭:接收时发生意外错误。



内部异常消息:无法从传输连接读取数据:远程主机强行关闭现有连接。



内部异常消息:现有连接被远程主机强行关闭



我的Web.config是



Hi,

I have developed WCF service that returns the bytes of the file.

But If the file size is more than 40 MB it is giving me the error

Exception Message: An error occurred while receiving the HTTP response to http://localhost:56198/Service.svc.This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Inner Exception Message: The underlying connection was closed: An unexpected error occurred on a receive.

Inner Exception Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Inner Exception Message: An existing connection was forcibly closed by the remote host

My Web.config is

<bindings>
      <basicHttpBinding>
        <binding name="basicHttpEndpointBinding" closeTimeout="01:01:00"

          openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"

          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

          maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"

          messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"

          useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"

            maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"

              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="ServiceBehavior1" name="Service">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" contract="IService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior1">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>







我在CLient方面做了同样的改变,但仍然没有成功



我尝试了什么:



我试过更改绑定properties




I have done the same changes on the CLient side but still no success

What I have tried:

I have tried changing the bindings properties

推荐答案

HI,



我认为问题如下:



transferMode

合同

behaviorConfiguration

行为名称= ServiceBehavior1



调查一下并尝试解决。


I think problem is in following :

transferMode
Contract
behaviorConfiguration
behavior name=ServiceBehavior1

Look into this and try to solve.


这篇关于Max在WCF中收到了消息大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆