I have a .NET 3.5 website that is uploading files to a SQL Server 2008 filestream. This all works great until I hit a certain file size and I unexpectedly get odd error returns in the browser.
In IE 7, if I upload a file with a size of about 100 meg, the browser returns after about 2 minutes with an error saying "Internet Explorer cannot display the webpage". Completely generic and totally useless error. Were it a timeout issue, then I would expect to see an error with a little more explanation.
In Firefox 3.6.7, when uploading the same file the browser returns after about 4 minutes with an equally generic and useless error that says "The connection was reset". Again, were it a timeout error (eg - somewhere in my code I have a connection timing out) then I would at the very least expect Firefox to return after 2 minutes with the generic error, because IE returned after just 2 minutes.
I need some ideas on how to diagnose this and hopefully track down what is causing the problem.
Also, I have the file upload size limited to 1 gig in the web.config.
<!-- 1 Gig upload -->
<httpRuntime maxRequestLength="1048576" />
EDIT:
Are there any settings in IIS 7 that could be affecting this? I'm not an IIS guru, so I may have configured my website wrong.
Jagd,
Try modifying your webconfig with:
<system.web>
<httpRuntime executionTimeout="999999" maxRequestLength="51200" />
The answer:
MSDN requestLimits
The web.config has a section for fine tuning websites running under IIS 7. I'm amazingly ignorant when it comes to IIS 7, so it's small wonder that I ran into this problem.
<security>
<requestFiltering>
<!-- 2 gig max upload -->
<requestLimits maxAllowedContentLength="2147483648"></requestLimits>
</requestFiltering>
</security>
The default value for maxAllowedContentLength is 30000000 bytes. Do a bit of math and you'll discover that 30000000 bytes equals 29,296.875 KB, which explains why I could upload a file with 29,174 KB, but not one with 29,308 KB.
As soon as I upped this valued, my file upload worked for the bigger PDF's.
精彩评论