但配置应允许上传

但配置应允许上传

本文介绍了连接重置由于大文件上传,但配置应允许上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的MVC项目中上传超过4MB的文件时出错。上传工作正常小文件。在线看,我看到我应该添加

< httpRuntime maxRequestLength =200000executionTimeout =240/>

到我的web配置,在系统网络,但是没有效果。连接仍然重置。是否还有其他配置需要更改,我可能错过了?这个文件是10兆,所以请求长度足够大。

请求不超时,连接立即复位。 b

我也尝试加入

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

到web config的webserver部分,也没有效果。 Web配置是位于正确的项目中的一个,并且连接永远不会到达位于我的控制器中的断点,这使我相信这必须是一个配置问题,其中具有太大文件的http请求被拒绝。如果是这种情况,为什么maxrequestlength属性不能解决问题?

解决方案

:/。发现问题。我一直在将maxRequestLength添加到错误的Web配置中。在视图中有一个webconfig文件,在完整的项目中有一个。我把它放在视图里面。甚至没有意识到有2个,有几个人也错过了。可怕的设计,把两个相同名称和相似目的的文件放在项目中,只用一层文件深度分隔。


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?

解决方案

:/. 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.

这篇关于连接重置由于大文件上传,但配置应允许上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 03:10