maxReceivedMessageSize and maxBufferSize in app.co

2019-01-23 22:24发布

How to increase maxReceivedMessageSize and maxBufferSize parameters in app.config file to 2000000 before running the application.

7条回答
唯我独甜
2楼-- · 2019-01-23 22:59

Open app.config on client side and add maxBufferSize and maxReceivedMessageSize attributes if it is not available

Original

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Service1Soap"/>
      </basicHttpBinding>
    </bindings>

After Edit/Update

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Service1Soap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
      </basicHttpBinding>
    </bindings>
查看更多
不美不萌又怎样
3楼-- · 2019-01-23 23:02

You can do that in your app.config. like that:

maxReceivedMessageSize="2147483647" 

(The max value is Int32.MaxValue )

Or in Code:

WSHttpBinding binding = new WSHttpBinding();
binding.Name = "MyBinding";
binding.MaxReceivedMessageSize = Int32.MaxValue;

Note:

If your service is open to the Wide world, think about security when you increase this value.

查看更多
姐就是有狂的资本
4楼-- · 2019-01-23 23:05

Easy solution: Check if it works for you..

Goto web.config

Find binding used by client.

change as,

maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"

Done.

查看更多
聊天终结者
5楼-- · 2019-01-23 23:05
binding name="BindingName" 
maxReceivedMessageSize="2097152" 
maxBufferSize="2097152" 
maxBufferPoolSize="2097152" 

on client side and server side

查看更多
做自己的国王
6楼-- · 2019-01-23 23:09

If you are using a custom binding, you can set the values like this:

<customBinding>
    <binding name="x">
        <httpsTransport maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
    </binding>
</customBinding>
查看更多
叼着烟拽天下
7楼-- · 2019-01-23 23:10

You need to do that on your binding, but you'll need to do it on both Client and Server. Something like:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding maxBufferSize="64000000" maxReceivedMessageSize="64000000" />
        </basicHttpBinding>
    </bindings>
</system.serviceModel>
查看更多
登录 后发表回答