简体   繁体   English

IIS 7的最大默认POST请求大小 - 如何增加64kB / 65kB限制?

[英]Maximum default POST request size of IIS 7 - how to increase 64kB/65kB limit?

I have created a RESTful POST web service in ASp .net C# with IIS hosting the service. 我在ASp .net C#中创建了一个RESTful POST Web服务,其中IIS托管了该服务。

My service accepts an XML file as input and when the size exceeds 65KB I get the following error message: 我的服务接受XML文件作为输入,当大小超过65KB时,我收到以下错误消息:

The remote server returned an error: (400) Bad Request. 远程服务器返回错误:(400)错误请求。

my question is two fold, first is there a default limit set by the IIS server for POST requests and secondly how can I update this? 我的问题是双重问题,首先是IIS服务器为POST请求设置了默认限制,其次是如何更新此问题?

Many Thanks 非常感谢

Have you tried adding the following to your web.config? 您是否尝试将以下内容添加到web.config中?

<system.webServer>
<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="1000000" />
    </requestFiltering>
</security>
<system.webServer>

This will bump up your allowed content length to a megabyte. 这会将允许的内容长度提升到兆字节。 Also, you may want to set the maxReceivedMessageSize attribute of your WCF bindings to more than the default 64k: 此外,您可能希望将WCF绑定的maxReceivedMessageSize属性设置为超过默认的64k:

<webHttpBinding>
    <binding name="MessageSizeWeb" maxReceivedMessageSize="2147483647" />
</webHttpBinding>

John Källén's answer was correct, but in my case I had an end point defined so setting the maxReceivedMessageSize had to be as follows: JohnKällén的答案是正确的,但在我的情况下我定义了一个终点,因此设置maxReceivedMessageSize必须如下:

<standardEndpoints>
    <webHttpEndpoint>
        <standardEndpoint name="" 
                         helpEnabled="true" 
                         automaticFormatSelectionEnabled="true"                   
                         maxReceivedMessageSize="2147483647">
        </standardEndpoint>
    </webHttpEndpoint>
</standardEndpoints>

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

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