The file app_offline.htm does not work

I've been struggling with this for ages, but I just can't get it to work.

Every blog / site that I also talked about, you don’t have to do anything in IIS, but it cannot be right, because there are several website configurations, such as application, virtual directory, simple php / asp, vitual sites.

Can someone please explain to me what the installation should look like in IIS7.

I have:

  • Checked spelling of file: app_offline.htm
  • Make sure the file has at least 512 bytes (this can be seen on a random site)
  • Make sure that it is actually at the root of the application / website
  • Checked that I can go directly to the file
  • Verify that the application pool frame is set to v2.0 or v4.0
  • Verify that the specified application pool has been assigned to my website.
  • Tried this on a new website in IIS, where app_offline.htm was the only file in the root.

I have several websites that I tested, namely:

  • MVC3 Web Application
  • Simple PHP Website
  • Classic ASP Simple Website
  • Web site
  • Webforms Application
  • Virtual folders on the above sites
  • Applications on these sites

All of the above works, and placing app_offline.htm does absolutely nothing.

Please someone can give some clarity.

+7
source share
9 answers

So, I never found a solution to this problem, but I found an alternative to what I was trying to achieve.

Basically, I wanted to show a specific "stand-alone" page for each application, which would be displayed when the site was turned off. Here is what I did ...

I created a website that I called "_offline" in IIS. Then I added a common catch-all binding for the port: 80 and left the host name blank. You may need to disable the current website by default until this commitment is accepted.

Create an index.html page and place the content you want to show and run it as the default page for "_offline". I will add a little script below that works very well.

Now you can test by disabling your site, you will see your new index page. If you cannot disable the website, add the binding in your hosts file to something like "testdomain.com" and point it to your server. After that, your offline page should appear in your browser.

Just in mind, this page will be displayed at any time when your IIS cannot find the active site at the incoming address. Depending on your installation, this may or may not be acceptable, in which case you should not use this method.

Now for my index page. I installed some javascript to determine which site is trying to reach, then the html part will show. I also have a countdown that starts and tries to refresh the page every 10 seconds.

In any case, this is not an ideal result, but it works.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width = device-width"> <title>Under Maintenance</title> </head> <style> body{ color:#014795; } .container{ max-width:650px; margin:auto; font-size:18px; font-family:Arial, Helvetica, sans-serif; padding:20pt; text-align:center } #logo img { max-width:100%; } a { color: inherit; text-decoration: none; } a:hover { color: inherit; text-decoration: none; } </style> <body> <table class="container"> <tr> <td> <span id="logo"></span> <p>This site is currently under maintenance and will be available shortly.</p> <p>We apologize for any inconvenience caused.</p> <table style="text-align:left;margin:auto;"> <tr><td>Telephone:</td><td><a href="tel:+27111111111">+27 11 11 1111</a></td></tr> <tr><td>Fax:</td><td>+27 11 111 2222</td></tr> <tr><td>Email:</td><td><a href="mailto: support@fubar.com "> support@fubar.com </a></td></tr> </table> <p>We will automatically try to reconnect you in <span id="timeleft"></span> seconds</p> </td> </tr> </table> <script type="text/javascript"> var refreshEvery = 10; var currentSec = 0; var timer = setInterval(function() { currentSec++; if (currentSec >= refreshEvery) { clearInterval(timer); location.reload(); } document.getElementById("timeleft").innerHTML = "" + (refreshEvery - currentSec); }, 1000) document.getElementById("timeleft").innerHTML = "" + (refreshEvery - currentSec); // Use this site to create a base64 image http://www.base64-image.de/step-1.php if (document.domain.indexOf("stacksnippets") >= 0) { // Cusomise the site here, you can also show hide html content. document.body.style.backgroundColor = "black"; document.body.style.color = "white"; } else { // put default stuff here } </script> </body> </html> 
+1
source

I recently had the same problem with the app_offline file, and the real problem I ran into was that the windows had a restriction on hidden file extensions. Therefore, when the app_offline.htm file was created, I thought the name was correct, but the windows hid the .txt extension.

+14
source

Create a web.config file with the following contents

 <?xml version="1.0"?> <configuration> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration> 

Hope this helps.

+5
source

I am also struggling a bit with this problem.

Along with the above criteria in other answers. It turns out that the file type MUST be specified specifically .htm NOT.html.

+3
source

I had the same problem, and although I could not solve it, I found a reasonable solution. I added the same file, but with the name "appoffline.htm" to the root directory and left it there forever.

When I need to disconnect the application, I use the IIS HTTP redirection option for the website to redirect all incoming requests to appoffline.htm (be sure to check "Redirect all requests to the exact destination").

+1
source

The following handler must also be present:

 ExtensionlessUrlHandler-Integrated-4.0 
0
source

Verify that an application name has been created in IIS Manager in the properties of the website. Properties> Catalog> Application Settings> Application Name. Tested in IIS V6.0

0
source

IIS is quite sensitive to the contents of the app_offline.htm file. Try starting with something very simple, like

 <html><body>offline</body></html> 

to see if this solves the problem.

0
source

Try starting with a fresh and simple app_offline.htm file, for example

 <html><body>offline</body></html> 

to see if this solves the problem. In my case, the problem was that the encoding of the app_offline.htm file was "UTF-8 with BOM" and not plain UTF-8.

0
source

Source: https://habr.com/ru/post/1495525/


All Articles