Connection Reset due to large file upload but configs should permit upload

旧街凉风 提交于 2020-01-15 12:05:11

问题


I am having errors attempting to upload a file larger than 4 megs in my MVC project. The upload works fine for smaller files. Looking online, I saw that I should add

<httpRuntime maxRequestLength="200000" executionTimeout="240"/>

to my web config, in system web, but that has had no effect. The connection is still resetting. Are there other configs that need to be changed that I may have missed? The file is 10 megs, so that request length is plenty large enough.

The request is not timing out, the connection is reset instantly.

I also tried adding

<security >
  <requestFiltering>
    <requestLimits maxAllowedContentLength="1024000000" />
  </requestFiltering>
</security>`

to my webserver section in web config, but that had no effect either. The web config is the one located in the correct project, and the connection never reaches the breakpoint located in my controller, which makes me believe that this must be a config problem where an http request with a too-large file is being rejected. If that is the case, why doesn't the maxrequestlength attribute fix the problem?


回答1:


just an update for IIS 7.x

you will need to add the following for newer versions of IIS:

<security>
    <requestFiltering>
          <requestLimits maxUrl="32767" maxQueryString="32767" 
            maxAllowedContentLength="2147483648"/>
    </requestFiltering>
</security>



回答2:


:/. Found the problem. I had been adding maxRequestLength to the wrong web config. There is one webconfig file in views, and one in the full project. I was putting it inside of views. Wasn't even aware of the fact that there were 2, and several people missed it as well. Terrible design to put two identically named and similarly purposed files inside of the project, seperated by only one layer of file depth.



来源:https://stackoverflow.com/questions/10741568/connection-reset-due-to-large-file-upload-but-configs-should-permit-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!