• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

jmoss
#1 Posted : Friday, April 24, 2009 3:14:38 PM(UTC)
jmoss

Rank: Member

Joined: 10/19/2005(UTC)
Posts: 11

Since upgrading to version 5.5, we are having a problem when we upload an image and select "resize to...". The image uploads but does not resize, and the error given is:


<SPAN id=ctl00_BvcAdminPopupConent_lblError class=errormessage>Error Code 5003-5 Couldn't Resize Image: The process cannot access the file 'D:\...\file.jpg' because it is being used by another process.



Can you help? I've checked permissions and can't find any issues that would cause this.



thanks!
Marcus
#2 Posted : Friday, April 24, 2009 6:20:47 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Try stopping your application pool for the web site and then start it again. The file has been locked by another version of your IIS app pool.
jmoss
#3 Posted : Friday, April 24, 2009 8:20:51 PM(UTC)
jmoss

Rank: Member

Joined: 10/19/2005(UTC)
Posts: 11

I have tried that, and have also tried creating a new application pool. Also tried running the application pool under different users, all with the same results. It won't resize any images......
Marcus
#4 Posted : Saturday, April 25, 2009 8:15:38 AM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

We didn't change any of the resize code in 5.5. In fact, it hasn't been changed since SP2 so I think it is probably something to do with Windows and file locks or permissions.

Try checking the permissions for the user account that runs your web site and see if they have access to the files/folders. It is possible that during the upgrade files were overwritten and permissions are not getting inherited from root folders anymore.
jmoss
#5 Posted : Saturday, April 25, 2009 2:54:24 PM(UTC)
jmoss

Rank: Member

Joined: 10/19/2005(UTC)
Posts: 11

I have checked all permissions and run a process explorer. It seems the file is locked by w3wp.exe - there is a dll process and a handle locking the file. If I release the lock manually, it frees the file. Otherwise it seems to be locking the file for at leat 60 seconds. Could this be related to .net 3.5 in any way?




This is the asp.net error stack trace I get:



[IOException: The process cannot access the file 'D:\inetpub\wwwroot\vectra_fitness_store\images\15780tset.jpg' because it is being used by another process.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7714720
System.IO.File.Delete(String path) +7574888
BVAdmin_ImageBrowser.DeleteCurrentFile() in D:\inetpub\wwwroot\vectra_fitness_store\bvadmin\ImageBrowser.aspx.vb:269
BVAdmin_ImageBrowser.btnDelete_Click(Object sender, ImageClickEventArgs e) in D:\inetpub\wwwroot\vectra_fitness_store\bvadmin\ImageBrowser.aspx.vb:260
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Marcus
#6 Posted : Saturday, April 25, 2009 4:11:01 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Can you manually delete the image and then reupload it?
jmoss
#7 Posted : Saturday, April 25, 2009 4:22:08 PM(UTC)
jmoss

Rank: Member

Joined: 10/19/2005(UTC)
Posts: 11

Yes, I can manually delete the image (after the lock has released or I manually recycle the app pool). And I can reupload the image - it doesn't have a problem uploding or deleting any images, or renaming images or copying images. Only when asking it to resize an image that I am uploading. I'm looking at procmon now, and it seems that the file ends up in a "sharing violation". But I don't know where to look from there...
toasty0621
#8 Posted : Wednesday, May 27, 2009 6:24:51 PM(UTC)
toasty0621

Rank: Member

Joined: 5/18/2005(UTC)
Posts: 36

Thanks: 3 times
Did this ever get resolved? Because I am having the same issues and wondered if there was a solution? Thanks.
Customizer
#9 Posted : Thursday, May 28, 2009 3:22:44 AM(UTC)
Customizer

Rank: Member

Joined: 9/26/2008(UTC)
Posts: 121

Marcus,
The error comes from BVSoftware.Web.Images.ShrinkImageFileOnDisk procedure. I think the problem comes from Image.FromFile function which creates Image object from file. But it opens the file with no sharing option. The solution is to read file content manually setting sharing options for reading and to use Image.FromStream() instead of FromFile.
http://www.software-development-innovations.com - affordable web customization and development service
toasty0621
#10 Posted : Friday, May 29, 2009 5:30:41 PM(UTC)
toasty0621

Rank: Member

Joined: 5/18/2005(UTC)
Posts: 36

Thanks: 3 times
Hey Customizer do you have a fix for this that we can do on our sides?

Thank you in advance.
Narrowpath
#11 Posted : Saturday, May 30, 2009 10:28:25 PM(UTC)
Narrowpath

Rank: Member

Joined: 9/20/2006(UTC)
Posts: 92

We can offer an immediate fix for this issue. Feel free to contact us via phone or email if you need assistance.

Wallace Miller -- Narrowpath Design
Providing installation, custom development, and design services for BVC5 sites
24/7 tech support and consultation service available for BVSoftware E-Commerce
760.728.8679 (phone)
[email protected]
Marcus
#12 Posted : Wednesday, June 3, 2009 12:18:16 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

"Customizer" was correct about the file lock issue. Attached is a new BVSoftware.Web.DLL which corrects the issue.

1) Download the zip file

2) Unzip to a temporary location

3) Copy BVSoftware.web.dll and BVSoftware.web.pdb to the /bin folder of your web site.

Image resizing should now work correctly.
File Attachment(s):
BVSoftware.Web.Post55Update.zip (32kb) downloaded 189 time(s).

You cannot view/download attachments. Try to login or register.
Narrowpath
#13 Posted : Wednesday, June 3, 2009 3:07:23 PM(UTC)
Narrowpath

Rank: Member

Joined: 9/20/2006(UTC)
Posts: 92

Here's the source-code change for the above "HOTFIX" in case anyone has a modified BVSoftware.Web.DLL





Code:

public static void ShrinkImageFileOnDisk(string originalFile, string newFileName, int maxWidth, int maxHeight)
{
FileStream fs = new FileStream(originalFile, FileMode.[b][/b][b][/b]open, FileAccess.Read);
Bitmap origImg = (System.Drawing.Bitmap)Image.FromStream(fs);
fs.Close();
fs.Dispose();
Bitmap output = ShrinkImage(origImg, maxWidth, maxHeight);
ImageFormat format = origImg.RawFormat;
FileInfo tempFile = TempFiles.GetTemporaryFileInfo();
output.Save(tempFile.FullName, format);
if (File.Exists(newFileName))
{
File.SetAttributes(newFileName, FileAttributes.Normal);
File.Delete(newFileName);
}
File.Copy(tempFile.FullName, newFileName);
origImg.Dispose();
output.Dispose();
}


Wallace Miller -- Narrowpath Design
Providing installation, custom development, and design services for BVC5 sites
24/7 tech support and consultation service available for BVSoftware E-Commerce
760.728.8679 (phone)
[email protected]
Aaron
#14 Posted : Wednesday, June 3, 2009 5:06:23 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Thanks, Wallace. That saved me a trip to Reflector.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Marcus
#15 Posted : Wednesday, June 3, 2009 10:15:25 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Wallace,

I didn't post this code yet and I appreciate that you're anxious to help out the community. Please be careful when posting source code as it's copyrighted material and most of it is limited to maintenance plan customers only.

Thanks!
Narrowpath
#16 Posted : Wednesday, June 3, 2009 11:56:23 PM(UTC)
Narrowpath

Rank: Member

Joined: 9/20/2006(UTC)
Posts: 92

Marcus,

Ophs! Feel free to delete the post if necessary.

Wallace Miller -- Narrowpath Design
Providing installation, custom development, and design services for BVC5 sites
24/7 tech support and consultation service available for BVSoftware E-Commerce
760.728.8679 (phone)
[email protected]
Aaron
#17 Posted : Thursday, June 4, 2009 1:11:58 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Wallace,
There is an error in the code you posted:

Code:
FileStream fs = new FileStream(originalFile, FileMode.open, FileAccess.Read);


The "O" in "open" should be capitalized. However, I believe that there is actually a bug in the message board that is removing the capitalization. I tried to post a correction and it outputs the wrong case.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Narrowpath
#18 Posted : Thursday, June 4, 2009 2:38:45 PM(UTC)
Narrowpath

Rank: Member

Joined: 9/20/2006(UTC)
Posts: 92

Aaron,

Good catch! Yeah, it must be a bug in the message board because I checked the code in our Web project and the "O" in "open" is capitalized.

Wallace Miller -- Narrowpath Design
Providing installation, custom development, and design services for BVC5 sites
24/7 tech support and consultation service available for BVSoftware E-Commerce
760.728.8679 (phone)
[email protected]
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012