Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes when deploying .NET code in IIS6 I can't rename or delete the .NET application folder because it's in use. The only thing that seems to fix it is stopping the w3svc service, doing what I need to do then starting it again.

This isn't ideal when there are other web applications being served on the web server. Just stopping that particular virtual web site doesn't seem to work either.

Is there a better way to do this?

share|improve this question

Try this:

  1. In Internet Information Services, right click on the web site and choose Properties
  2. Go to the Home Directory Tab
  3. Click Unload (in the bottom right hand corner)
share|improve this answer
This option is grayed out. Am I missing something? – Garry Harthill Jun 1 '09 at 10:22
When it's greyed out, the site is not loaded (by IIS at least). Something else might be pinning it down. I've had the search service pin down a directory to index it. It could also be an open EXPLORER window or a CMD shell with the default directory set to the directory in question. – Joel Spolsky Jun 2 '09 at 1:27

Drop the AppOffline.aspx file in the directory where you want to make changes. That will allow you to rename or delete that directory or any folders/files therein. I always deploy with a file named AppOfflineNOT.aspx. Then remove/replace the "NOT" as needed. This way you don't have to mess with iis when updating your site.

share|improve this answer
Its actually app_offline.htm - and it must have a minimum of content in it, can't just be an empty file. – Kieran Benton May 29 '09 at 9:17

There is a similar question here: How to get IIS7 to release a locked file?

share|improve this answer

If you really need to frequently change that, you can,

  1. Run the web site in a standalone application pool.
  2. Before modification, stop the application pool.
  3. After modification, start that pool.
share|improve this answer

Here is a very simple way to get around all of the above.

  1. Go to Start > Run.
  2. Enter IISReset then OK

This will do a start and stop of the service and will free up any lingering processes before you do your code refresh. Just be ready to push your code as soon as the command is done to avoid anyone jumping on to the server and creating a lock. I usually write an xcopy script to run immediately after.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.