簡體   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