尝试上传重图片时,“连接已重置”浏览器错误

时间:2023-02-08 21:15:34

I am trying to upload a picture from ASP:fileupload control. When user select JPG file from local disk and click on Button ,it will upload to server.

我试图从ASP上传图片:fileupload控件。当用户从本地磁盘中选择JPG文件并单击Button时,它将上传到服务器。

This is working fine and upload picture as expect.

这工作正常,并按预期上传图片。

However when user give heavy image like 8MB the browser gives an error.

但是,当用户提供像8MB这样的大量图像时,浏览器会出错。

The connection was reset. The connection to the server was reset while the page was loading.

I debug the code and try to figure out from where is occur. However I couldn't point the issue. It will not trigger Page load event or button click event either.

我调试代码并试图找出发生的位置。但我无法指出这个问题。它也不会触发页面加载事件或按钮单击事件。

Please help me to avoid this error or validate the file size before file upload the image.

请帮我在文件上传图片之前避免此错误或验证文件大小。

1 个解决方案

#1


1  

Try set theese in web.config (if there is a nested one beside the file upload then there two):

尝试在web.config中设置theese(如果在文件上传旁边有一个嵌套的那么,那么有两个):

<system.web>
      <httpRuntime maxRequestLength="16384" executionTimeout="120" />
    </system.web>

The settings above means: the maximum request length with all data (Post, files, etc) is 16 MB and the request will timeout after 120 seconds. Ofcourse you can adjust these values.

上面的设置意味着:所有数据(帖子,文件等)的最大请求长度为16 MB,请求将在120秒后超时。当然你可以调整这些值。

#1


1  

Try set theese in web.config (if there is a nested one beside the file upload then there two):

尝试在web.config中设置theese(如果在文件上传旁边有一个嵌套的那么,那么有两个):

<system.web>
      <httpRuntime maxRequestLength="16384" executionTimeout="120" />
    </system.web>

The settings above means: the maximum request length with all data (Post, files, etc) is 16 MB and the request will timeout after 120 seconds. Ofcourse you can adjust these values.

上面的设置意味着:所有数据(帖子,文件等)的最大请求长度为16 MB,请求将在120秒后超时。当然你可以调整这些值。