And*_*uiz 2 c# asp.net upload file
我有一个asp.net Web表单应用程序,我正在尝试使用FileUpload控件上传一个大型文件(13 MB),当我按下提交按钮时,Web浏览器开始上传文件.但是,当Web浏览器完成上传时,应用程序无故失败,并且不会出现任何异常,也不会输入提交按钮的单击事件代码(c#).在我的web.config中,我设置了maxAllowedContentLength选项和maxRequestLength选项.
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)
<httpRuntime targetFramework="4.5" executionTimeout="900" maxRequestLength="2097151" />
Run Code Online (Sandbox Code Playgroud)
这只发生在Web服务器(Windows Server 2012)中,在我的本地服务器中没有发生这种情况.在webserver中显示一个默认错误(我不管理服务器,所以我看不到发生了什么自定义错误)
我不知道为什么会这样,因为在网络服务器中,文件上传选项的应用程序更大.
谢谢你的帮助.
web.config按照Stricture 修改你的,这里我使用的最大文件请求长度为13 MB,最大允许内容长度为1 GB.
现在更改<system.web>web.config中的后面
<httpRuntime targetFramework="4.5" maxRequestLength="13631488" executionTimeout="9000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="1000" />
Run Code Online (Sandbox Code Playgroud)
并<system.webServer>在web配置后面编写此代码
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)
谢谢