views:

765

answers:

4

Hi all. I've got a weird problem. It looks like if my IIS6 locked an application's web.config. If I try to edit it, Windows complains that the web.config is used by another process.

Using Process Explorer I can see that the file is owned by w3wp.exe. Removing the virtual directory and stopping the website wasn't useful at all.

Any idea (I cannot stop the whole server since a lot of sites are hosted in it)?

Thanks in advance

+1  A: 

I would try stopping the application pool for the website that is accessing the web.config.

notandy
I've tried that. I've moved the application to a new application pool do that I could stop it without affecting any other app, but with no luck.
pomarc
the sysadmin recycled all the app pools, which is a very bad solution, but it worked. I am still perplexed.
pomarc
A: 

If you're using an x32 based system, you could try using Unlocker to 'unlock' the file, or possibly delete web.config and then recreate it. Failing that, you could kill the w3wp.exe worker process, which should automatically restart.

Mun
using unlocker or stopping w3wp.exe on a production server is a No-No, according to the sysadmins...
pomarc
A: 

Best bet would be to rename the web config (maintianing the lock on that file) and recreating the file. I'm not sure what would lock the file, but the app pool recycle should have freed the lock.

Christopher_G_Lewis
excuse me, I can't understand: for what I know you cannot rename a locked file...
pomarc
Actually, you *can* RENAME a locked file. You can't copy it, you can't move it, but you can change its name. The lock will remain on the renamed file, allowing you to create a new web.config.
Christopher_G_Lewis
A: 

FIXED: I was facing the same problem and it was resolved by disposing the object in code behind:

FileUpload1.Dispose()

and all other object related to handle that file

Ammar