asp.net file upload The connection to the server was reset while the page was loading

StackOverflow https://stackoverflow.com/questions/13934221

  •  10-12-2021
  •  | 
  •  

Domanda

When I am trying to upload file of 32MB, firefox is showing following error on page.

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

I have tried foll. solutions -

1 . in <system.web>

<httpRuntime maxRequestLength="2000000000" executionTimeout="999999"/>

2 . in <system.webserver>

 <security>
  <requestFiltering>
          <requestLimits maxAllowedContentLength="2000000000" />
  </requestFiltering>
 </security>

and

<compilation defaultLanguage="c#" debug="false" />

but still getting same error. I think problem is related to "executionTimeout". Application is not setting this timeout for request.

È stato utile?

Soluzione

Finally problem resolved... We need to keep both tags in config file. i.e.

<httpRuntime maxRequestLength="2000000000" executionTimeout="999999"/>

and

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="2000000000" />
    </requestFiltering>
</security>

Actually I was commenting one line and testing with another. :)

Altri suggerimenti

First: Notice that maxRequestLength is in KB whereas maxAllowedContentLength is in bytes
So you're just allowing 1MB... Increase your maxAllowedContentLength, for instance:

<requestLimits maxAllowedContentLength="2000000000" />

Second: Try a higher execution time such as executionTimeout="999999"

I have solved the issue and set: <httpRuntime maxRequestLength="2097151" executionTimeout="999999"/> inside tag in the web.config file.

if maxRequestLength="2000000000" does not support then use the range 0-2097151

Hope this helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top