繁体   English   中英

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

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

我在ASp .net C#中创建了一个RESTful POST Web服务,其中IIS托管了该服务。

我的服务接受XML文件作为输入,当大小超过65KB时,我收到以下错误消息:

远程服务器返回错误:(400)错误请求。

我的问题是双重问题,首先是IIS服务器为POST请求设置了默认限制,其次是如何更新此问题?

非常感谢

您是否尝试将以下内容添加到web.config中?

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

这会将允许的内容长度提升到兆字节。 此外,您可能希望将WCF绑定的maxReceivedMessageSize属性设置为超过默认的64k:

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

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