DotNetNuke Daily Tip #5 6/28/06 Cannot access a closed file

Published Wednesday, June 28, 2006 2:18 PM
Check out all of the DotNetNuke Daily Tips from Chris Hammond.

DotNetNuke Daily Tip for 6/28/2006

If you've ever received the following error while trying to upload a DotNetNuke module here's a quick fix.

ExceptionSystem.ObjectDisposedException: Cannot access a closed file. at System.IO.__Error.FileNotOpen() at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin) at System.Web.HttpRawUploadedContent.TempFile.GetBytes(Int32 offset, Int32 length, Byte[] buffer, Int32 bufferOffset) at System.Web.HttpRawUploadedContent.CopyBytes(Int32 offset, Byte[] buffer, Int32 bufferOffset, Int32 length) at System.Web.HttpInputStream.Read(Byte[] buffer, Int32 offset, Int32 count) at ICSharpCode.SharpZipLib.Zip.ZipInputStream.FillBuf(Int32 size) at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry() at DotNetNuke.Modules.Admin.ResourceInstaller.PaInstaller.ReadZipStream() at DotNetNuke.Modules.Admin.ResourceInstaller.PaInstaller.Install()

What version of DNN are you running? Is it 3.*? What version of the .Net framework is your site running on? If it's 2.0 that's most likely your case. We ran into this problem earlier today in our testing environment. To fix it, in IIS on the ASP.NET tab for your site be sure to set it to 1.1!

Thanks to Jianxiong for sending me the error message.

Stay tuned for another DotNetNuke Daily Tip coming tomorrow!

Comments

# fariborz said on Saturday, December 09, 2006 4:37 AM

hi dear thanks alot for your help I have that problem since past week and I can't solved it. thanks for your work. but why this problem occured?

# Bob said on Wednesday, October 24, 2007 10:23 AM

DOES NOT WORK!

# Chris Hammond said on Wednesday, October 24, 2007 10:38 AM

Great comment Bob, thanks for playing.

# Ayman Wassif said on Monday, November 12, 2007 11:18 AM

I fixed my problem by suppressing the Finalize on the base stream after I opened the file

Here is the Line I added after opening the file

GC.SuppressFinalize(myLogStream.BaseStream);

Then at the class destructor I could Flush and Close the file

# hi said on Thursday, June 04, 2009 10:16 PM

<httpRuntime maxRequestLength="8192" requestLengthDiskThreshold="8192"></httpRuntime>

----set the web.config file

This Blog

Syndication