简体   繁体   English

asp.net web api:IIS8 - (413) 请求实体太大

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

I have asp.net web api application hosted in IIS .我在IIS 中托管了asp.net web api应用程序。 This app has 100mb in <httpRuntime maxRequestLength=... and in <requestLimits maxAllowedContentLength=... .这个应用程序在<httpRuntime maxRequestLength=...<requestLimits maxAllowedContentLength=...有 100mb 。 But sometimes client gets 413 Request entity too large in resoponse for quite small requests.但有时客户端会收到413 Request entity too large ,以响应非常小的请求。 I saw some fixes like "just change uploadreadaheadsize".我看到了一些修复程序,例如“只需更改uploadreadaheadsize”。 But actually for me this solution is not clear.但实际上对我来说这个解决方案并不明确。 Why do I face this error when request limits are configured properly?为什么在正确配置请求限制时会遇到此错误?
Update1: one more detail - this app uses client certificates authentication.更新 1:更多细节 - 此应用程序使用客户端证书身份验证。
Update2 : I found this https://technet.microsoft.com/en-us/library/cc737382(v=ws.10).aspx更新 2 :我发现这个https://technet.microsoft.com/en-us/library/cc737382(v=ws.10).aspx

Here you can find a description of reason for this problem.您可以在此处找到此问题的原因描述。 I set uploadreadaheadsize to 1 mb instead of default 49152 b .我将uploadreadaheadsize设置为1 mb而不是默认的49152 b I used this powershell script:我使用了这个powershell脚本:

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

Actually I think this script should work too (it's not so global):其实我认为这个脚本也应该工作(它不是那么全局):

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