This was very interesting error, i got during development of file upload control in ASP.NET.
On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files.
whenever i tried to upload large size file i got error “cannot access a closed file”
After going through MSDN i found that there is one new element added in ASP.NET 2.0 known as httpRuntime.
So i just added this new Tag in my web.config and every thing was right.
<system.web> <httpRuntime maxRequestLength="15360" requestLengthDiskThreshold="15360"/> </system.web>
Note :
requestLengthDiskThreshold should not exceed the maxRequestLengthattribute. To read more about this, please visit http://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx
no i have putted in my web.config but not working
 plz check dude
Thanks! 😀 requestLengthDiskThreshold=”15360″ fixed the problem
Thnks… 🙂
Thanks, It’s Working…………….
Tanks man…. Excellent… fixed the problem…
Thanks it solved my Problem
Â
Thank you very very much . it solved my problem , Can u explaine the logical concept behind this
The guy you saved my life Thanks
Anderson Mariani from Brazil
Yes! Brazil is very Hot IT. Thanks
Thanks a lot!
Thank you. I finally solved the problem… The strange thing was that the error occourred also with small files (a 200KB PNG image). I only had a value (104857) for the first attribute (maxRequestLength) in my web.config, but not for the second. I added it with the same value and… everything’s working now.
It worked for me! Thanks very much! You are the guy!
It works
Thank you very much!!
Just having the tag is not enough. You must provide a value for requestLengthDiskThreshold (up to maxRequestSize). Default is 80 KB, but if you don’t explicitly set the value, the framework closes the stream after it buffers the first chunk.