ASP.NET 2.0 - How to use app_offline.htm

I read about the app_offline.htm file, which can be placed in the root of a .NET 2.0 application, which essentially closes the application and disconnects any other pages from the request.

I placed the file in the root and my site is still loading. I went to the default documents in IIS and set it to app_offline.htm and the site is still loading (this may be a caching problem)

Anyway, has anyone encountered problems using this? Am I doing something wrong?

+84
app-offline.htm
Jul 20 '09 at 13:04
source share
7 answers

I used the extremely convenient app_offline.htm trick to close / update sites in the past without any problems.

Make sure you actually put the app_offline.htm file in the "root" of the site that you configured in IIS.

Also make sure the file is named as it should be: app_offline.htm

Other than that, there should not be any other changes to IIS that you will need to make, because the processing of this file (with this specific name) is handled by the ASP.NET runtime, and not by IIS itself (for IIS v6).

Remember, however, that although placing this file in the root of your site will cause the application to "shut down" and display the contents of the file "app_offline.htm", any existing requests will still get the real website served them. Only new requests will receive the app_offline.htm content.

If you still have problems, try the following links for more information:

Scott Gu App_Offline.htm

App_Offline.htm and working on the Izhevsk Errors function

Will app_offline.htm stop current requests or only new requests?

+124
Jul 20 '09 at 13:23
source share

Make sure the app_offline.htm file is at least 512 bytes long. Zero byte app_offline.htm will have no effect.

UPDATE: Newer versions of ASP.NET/IIS may behave better than when I first wrote this.

UPDATE 2: If you are using ASP.NET MVC, add the following to web.config:

 <?xml version="1.0"?> <configuration> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration> 
+41
Feb 06 '11 at 20:59
source share

Note that this behaves the same in IIS 6 and 7.x and .NET 2, 3, and 4.x.

Also note that when app_offline.htm is present, IIS will return this http status code:

 HTTP/1.1 503 Service Unavailable 

It is all by design. This allows your load balancer (or something else) to see that the server is down.

+13
Apr 30 2018-12-12T00:
source share

Possible resolution problem

I know this post is quite old, but I ran into a similar problem and my file was spelled correctly.

I initially created the app_offline.htm file elsewhere, and then moved it to the root of my application. Because of my setup, I had a permission issue.

The website acted as if it were not there. Having created the file in the root directory instead of moving it, I fixed my problem. (Or you can just fix the permission in properties -> security)

Hope this helps someone.

+9
Dec 19 '11 at 2:51 p.m.
source share

Make sure app_offline.htm is located in the root of the virtual directory or website in IIS.

+2
Jul 20 '09 at 13:09
source share

I ran into a problem very similar to the original question, which took a little time to resolve.

Just run someone who is working on an MVC application and finds their way in this thread, make sure you have a wildcard mapping to the corresponding .Net aspnet_isapi.dll. As soon as I did this, my app_offline.htm began to behave as expected.




IIS 6 Configuration Steps

In the properties of the IIS application, select the virtual directory tab.

In the "Application Settings" section, click the "Configuration" button.

In the list of wildcard cards, click the "Insert" button.

Type C: \ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet_isapi.dll, click OK.

0
Feb 12 '15 at 19:45
source share

Make sure the file extensions are visible in Explorer and the file name is actually

app_offline.htm

not

app_offline.htm.htm

0
Mar 05 '17 at 2:42 on
source share



All Articles