WCF - 如何提高邮件大小配额配额、大小、邮件、WCF

2023-09-02 01:16:44 作者:鹿泽林辰

我有一个WCF服务返回1000条记录,从数据库到客户端。我有一个ASP.NET WCF客户端(我加在asp.net web应用项目的服务参考使用WCF)。

I have a WCF Service which returns 1000 records from database to the client. I have an ASP.NET WCF client (I have added service reference in asp.net web application project to consume WCF).

我收到以下消息当我运行客户端应用程序:

I get the following message when I run the client application:

的最大邮件大小配额传入消息(65536)已   超标。要增加配额,使用   在MaxReceivedMessageSize物业   相应的绑定元素。

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

任何帮助吗?如何增加邮件大小配额?

Any help? How to increase message size quota?

推荐答案

您会希望这样的事情来增加邮件大小配额,在的App.config 或的Web.config 的文件:

You'll want something like this to increase the message size quotas, in the App.config or Web.config file:

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="20000000" 
                 maxBufferSize="20000000"
                 maxBufferPoolSize="20000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="200000000"
                 maxStringContentLength="200000000"/>
        </binding>
    </basicHttpBinding>
</bindings>

的理由的价值观很简单,他们是足够大,以适应大多数的消息。您可以调整这个数字,以满足您的需求。低默认值是基本上没有以prevent DOS类型的攻击。使其20000000将允许分布式DOS攻击是有效的,对64K的默认大小将需要非常大量的客户端,以压倒多数的服务器的这些日子。

The justification for the values is simple, they are sufficiently large to accommodate most messages. You can tune that number to fit your needs. The low default value is basically there to prevent DOS type attacks. Making it 20000000 would allow for a distributed DOS attack to be effective, the default size of 64k would require a very large number of clients to overpower most servers these days.

 
精彩推荐