2

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?

2

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)
  • 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
1

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.

  • 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
0

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

0

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.
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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