T
Taiwo
When I use the method "System.Drawing.Image.FromFile(pictureFile)" where
pictureFile is the path to a valid image file, the file is locked even
minutes after the statement executes. This code is in a web service hosted
in IIS on Windows XP. Typically, I have to run IISRESET from the Command
Line to be able to rename the file.
My work around is to use a different method:
Dim fs As FileStream = New FileStream(pictureFile, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite)
dim pic As Image = System.Drawing.Image.FromStream(fs)
fs.Close()
fs = Nothing
With this method, I open the file for Read Shared, use the FromStream
method, and close the file stream immediately.
The VS.NET team here may want to verify this.
pictureFile is the path to a valid image file, the file is locked even
minutes after the statement executes. This code is in a web service hosted
in IIS on Windows XP. Typically, I have to run IISRESET from the Command
Line to be able to rename the file.
My work around is to use a different method:
Dim fs As FileStream = New FileStream(pictureFile, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite)
dim pic As Image = System.Drawing.Image.FromStream(fs)
fs.Close()
fs = Nothing
With this method, I open the file for Read Shared, use the FromStream
method, and close the file stream immediately.
The VS.NET team here may want to verify this.