Tal*_*lon 8 deployment iis-7 app-offline.htm
我一直在与这个争斗多年,但我无法让它发挥作用.
我曾经说过的每个博客/网站都说你在IIS中没有什么需要做但这可能不正确,因为有多个网站配置,如应用程序,虚拟目录,简单的php/asp网站,vitual.
有人可以向我解释一下IIS7中的设置需要什么.
我有:
我设置了多个我测试过的网站,即:
所有上述工作都正常,并且放置app_offline.htm绝对没有任何作用.
请有人提供一些清晰度.
Dan*_*iel 13
我最近在app_offline文件中遇到了同样的问题,我遇到的真正问题是windows被设置为隐藏已知的文件扩展名.因此,当创建文件app_offline.htm时,我认为名称是正确的,但是Windows隐藏了扩展名.txt.
小智 6
创建具有以下内容的web.config文件
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
希望能有所帮助。
所以我从来没有找到解决这个问题的方法,但我确实找到了我想要实现的目标的替代方案。
基本上,我想为每个应用程序显示一个特定的“离线”页面,该页面将在网站离线时显示。这就是我所做的......
我在 IIS 中创建了一个名为“_offline”的网站。然后,我为端口 80 添加了通用的“catch all”绑定,并将主机名留空。在接受此绑定之前,您可能需要禁用当前的默认网站。
创建一个index.html页面并将您想要显示的任何内容放入其中并将其推入“_offline”的默认页面。我将在下面添加一些效果很好的脚本。
现在您可以通过关闭网站进行测试,您应该会看到新的索引页面。如果您无法关闭该网站,请在您的主机文件中添加一个类似于“testdomain.com”的绑定,并将其指向您的服务器。在浏览器中输入该内容后应该会显示您的离线页面。
请记住,只要您的 IIS 在传入的地址中找不到活动网站,此页面就会显示。根据您的设置,这可能会也可能不会接受,在这种情况下您不应使用此方法。
现在是我的索引页。我放入了一些 javascript 来确定用户试图访问哪个网站,然后显示 html 的一部分。我还有一个倒计时运行并尝试每 10 秒刷新一次页面。
无论如何,这不是理想的结果,但它确实有效。
<!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>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10576 次 |
| 最近记录: |