簡體   English   中英

asp.net web api:IIS8 - (413) 請求實體太大

[英]asp.net web api: IIS8 - (413) Request Entity Too Large

我在IIS 中托管了asp.net web api應用程序。 這個應用程序在<httpRuntime maxRequestLength=...<requestLimits maxAllowedContentLength=...有 100mb 。 但有時客戶端會收到413 Request entity too large ,以響應非常小的請求。 我看到了一些修復程序,例如“只需更改uploadreadaheadsize”。 但實際上對我來說這個解決方案並不明確。 為什么在正確配置請求限制時會遇到此錯誤?
更新 1:更多細節 - 此應用程序使用客戶端證書身份驗證。
更新 2 :我發現這個https://technet.microsoft.com/en-us/library/cc737382(v=ws.10).aspx

您可以在此處找到此問題的原因描述。 我將uploadreadaheadsize設置為1 mb而不是默認的49152 b 我使用了這個powershell腳本:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.webserver/serverruntime" -name "uploadreadaheadsize" -value 1048576

其實我認為這個腳本也應該工作(它不是那么全局):

Set-WebConfigurationProperty -PSPath "iis:\Sites" -location "sitename here" -filter "system.webserver/serverruntime" -name "uploadreadaheadsize" -value 1048576

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM