Error Message: ObjectDisposedException: Cannot access a closed file
Description:
When installing Form Master or other non-core modules on a DNN 3.2.2 installation with the IIS server configured to use .NET 2.0 the install fails with the error message below.
Error Message:
| StartJob |
Starting Installation |
| StartJob |
Reading files |
| Failure |
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() |
Resolution:
.NET 2 introduced some changes in how uploaded files were handled. DNN 4.x is preconfigured for this. DNN 3.2 requires a web.config change to the following element.
httpruntime requestLengthDiskThreshold="8192" maxRequestLength="8192" useFullyQualifiedRedirectUrl="true">
Note: I have found that 04.00.03 sometimes needs this modification as well