【问题标题】:asp.net web api: IIS8 - (413) Request Entity Too Largeasp.net web api: IIS8 - (413) 请求实体太大
【发布时间】:2016-05-05 09:04:56
【问题描述】:

我在 IIS 中托管了 asp.net web api 应用程序。这个应用程序在<httpRuntime maxRequestLength=...<requestLimits maxAllowedContentLength=... 中有 100mb。但有时客户端会收到413 Request entity too large 以响应非常小的请求。我看到了一些修复,例如“只需更改 uploadreadaheadsize”。但实际上对我来说这个解决方案并不清楚。为什么在正确配置请求限制时会遇到此错误?
Update1:​​更多细节 - 此应用使用客户端证书身份验证。
Update2:我找到了这个https://technet.microsoft.com/en-us/library/cc737382(v=ws.10).aspx

【问题讨论】:

    标签: asp.net iis http-status-code-413


    【解决方案1】:

    Here你可以找到这个问题的原因描述。我将 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
    

    【讨论】:

      猜你喜欢
      • 2020-05-04
      • 2014-12-30
      • 2014-12-23
      • 1970-01-01
      • 2012-09-23
      • 2015-10-04
      • 2015-01-25
      相关资源
      最近更新 更多