Reputation: 121
I have a asp.net web form app, i'm trying to upload a large file (13 mb) in a web form with a FileUpload control, when i press the submit button the web browser starts to upload the file. But, when the web browser finish the upload the app crash without reason, and doesn't lauch any exception, and not enter to the click event code (c#) of the submit button. In my web.config i have set the maxAllowedContentLength option and the maxRequestLength option.
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
<httpRuntime targetFramework="4.5" executionTimeout="900" maxRequestLength="2097151" />
This is only happening in the web server(Windows Server 2012), in my local server this is not happening. In the webserver show a default error (I don't manage the server, so i can't see what custom error is happening)
i don't know why this is happening, because in the web server are apps with file upload options even more bigger.
Thanks for your help.
Upvotes: 2
Views: 6403
Reputation: 121
the problem was a restriction on the server by the admin that doesn't allow upload large files. All the configuration given in this thread are correct.
Upvotes: 1
Reputation: 880
Modify your web.config
by following Stricture, Here I'm using max File request length 13 MB & max Allowed Content Length 1 GB.
Now change Behind the <system.web>
in web.config
<httpRuntime targetFramework="4.5" maxRequestLength="13631488" executionTimeout="9000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="1000" />
And Behind the <system.webServer>
in web config write this Code
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
Thanks
Upvotes: 7
Reputation: 152
If your maxAllowedContentLength has a big value, your executionTimeout must be big, too! It work in local because you don't need a long time to copy file in your hard. But when you upload your site in server, you need more executionTimeout.
Upvotes: 0
Reputation: 51
It looks like you're missing the opening "security" tag in your web.config
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
Upvotes: 0