How to get IIS7 to release a locked file?

Posted by Jarrod Dixon on Server Fault See other posts from Server Fault or by Jarrod Dixon
Published on 2009-05-10T06:59:22Z Indexed on 2010/04/16 12:33 UTC
Read the original article Hit count: 611

Filed under:
|
|

During our production builds, a very large (10 megabyte) static content file in the root directory will sometimes be locked by IIS and cannot be deleted by the clean task. This is presumably because it is being actively served to one or more clients at the time.

The build process stops the website before cleaning via

c:\Windows\System32\inetsrv\appcmd.exe stop site http://oursite.com

However, this does not release the file - we have to restart IIS to get the process to relinquish its lock.

appcmd.exe allows you to take IIS down completely; we do not want to do this!

Are there any other ways to get IIS to let go of a locked file, without restarting IIS? Simply stopping and starting the individual website is definitely not working to release the file lock.

© Server Fault or respective owner

Related posts about iis

Related posts about iis7