如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容

How to upload content more than 2 MB#39;s on website created using asp.net 4.0(如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容)
本文介绍了如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

可能重复:
如何在 ASP 中增加最大上传文件大小.NET?

我正在尝试验证用户上传的上传内容,如果我们上传小于 2 MB 的内容,它可以正常工作,但如果我们上传大于 2 MB 的内容,我们会收到错误连接已重置".

i m trying to validate an uploaded content uploaded by user, it works fine if we upload content lesser than 2 MB's, but if we upload content more than 2MB's, withour undergoing any process, we get an error "Connection is reset."

是否存在以及为什么要增加 asp.net web.config 文件中的限制?

is there and why to increase the limit in asp.net web.config file?

推荐答案

如果您要上传文件,请将其设置为 system.web 部分下的 Web.Config

If you are trying to upload a file, set this to Web.Config under system.web section

  <httpRuntime maxRequestLength="51200" executionTimeout="3600" />

其中 maxRequestLength 是以 KB 为单位的文件大小限制,而 executionTimeout 是以秒为单位的超时.根据需求设置此值.

where maxRequestLength is the file size limit in KB and executionTimeout is the timeout in seconds. Set this value as per the requirement.

这篇关于如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
How to store delegates in a List(如何将代表存储在列表中)
How delegates work (in the background)?(代表如何工作(在后台)?)
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)