Last post Feb 27, 2008 02:40 AM by nealdt
Feb 21, 2008 08:01 AM|nealdt|LINK
I've read about the amazing app_offline.htm feature from a hundred different blogs and they all mention how amazing it is. But I'm running into issues with the feature in a production environment. I put up an app_offline page when I want to bring my site
down to upload new bin DLLs, and the file works as promised. However, once I start uploading the new DLL files, any request to the site will result in an ASP.NET exception page complaining that file X.dll is in use by another process. Is there any way to bring
down my site but not show any errors like that while the new files are uploading?
Feb 27, 2008 02:28 AM|Benson Yu - MSFT|LINK
once I start uploading the new DLL files, any request to the site will result in an ASP.NET exception page complaining that file X.dll is in use by another process. Is there any way to bring down my site but not show any errors like that while the new files
If you place the app_offline.htm file in your web application, all the requests to this web application should be returned with the content of the app_offline.htm.
However, I should mention that you should input more contents in the app_offline.htm. If the response length less then 512 bytes, IE by defualt displays the 404 error.
At last, if the detailed exception message for X.dll is being used by another process still persist. I recommend you changing the “customErrors” mode to “RemoteOnly” in web.cofig. After setting that, all the remote requests will be returned
with the general error message instead of the actual one when exception occurs.
customErrors Element (ASP.NET Settings Schema)
Feb 27, 2008 02:40 AM|nealdt|LINK
I know that's what everyone says, but it's simply not what I experience on my site. If I place app_offline.htm in my app root, it does indeed redirect all requests to that page. However, if I start to upload a new version of a DLL to my /bin directory, I
get ASP.NET errors about files being in use. And if I delete the DLL before uploading the new copy, I get errors that the Global class (defined in global.asax) cannot be found. So clearly ASP.NET is still involved in the request pipeline... everyone makes
it sound like ASP.NET is unloaded and IIS handles everything by itself, but if that were the case I wouldn't be getting ASP.NET errors.
So what's a better pathway for uploading new DLLs without causing ANY errors whatsoever? I don't want my users to even see a
friendly error message... I just want them to see the contents of app_offline. I've tried renaming the bin directory, deleting the DLL before uploading a new copy, uploading the new DLL to a different directory and moving it over the old one... and none
of these offer a completely seamless transition from Site Up to Site Offline to Site Up without any errors being thrown. The only other option I can think of is moving Web.config (since it references a custom HTTP Handler and throws an exception if that handler
can't be loaded), Global.asax (references the Global class), and the /bin directory out of the app root, uploading the new DLLs to the moved /bin directory, then move everything back. But that's obviously an enormous pain.