1

My hosting company has just upgraded my server and moved my sites over. I develop in Visual Studio, and publish sites to a local folder, which I then upload via FTP (using FileZilla if it makes any difference).

On the old server, I kept a file named _App_Offline.htm in the wwwroot folder for each site. When I uploaded a new version, I renamed this to App_Offline.htm , which allowed IIS to release the files, I uploaded, then renamed the file back again. That all worked fine.

On the new server, renaming the file never allows IIS to release the files, so I can't upload the changes. I tried stopping the web site in my control panel, but that didn't help. I tried stopping the app pool. Usually that helps, but then starting it again almost always fails. It takes at least 15-20 attempts before it restarts.

Anyone any suggestions as to what might be the problem here? I realise there's not much to go on, but I'm not sure what else I can say. Here are some possibly relevant details...

  • Windows Server 2022
  • IIS 10
  • The server is running Windows FTP
  • All sites are .NET, either 6 or 7, mostly Blazor but some Razor pages

Please advise if there is any more info I can supply.

Thanks

1 Answers1

1

Oddly enough, although you can't delete or overwrite the files when IIS has a hold on them, you can rename them, and the site will carry on as before.

So, one way to get around this is to rename the critical files (which in my experience is usually only the main DLL), then copy up the new version, then use the app_offline.htm trick to restart the web site. When it restarts, you can delete the (old) renamed files.

In practice, you can't always delete the old file(s) immediately, but if you rename them to have a prefix of zzz, then they are tucked away out of sight at the bottom of the file list, and you can delete them next time you upload.

Overall, your time is the same, but instead of renaming app_offline.htm, uploading, then renaming back, you rename the DLL, upload and rename app_offline.htm twice in quick succession. The advantage of this is that you have far less downtime, basically the site is only down for as long as it takes you to rename app_offline.htm and rename it back.

Hope that helps.