I've read about the app_offline.htm
file which can be placed within the root of a .NET 2.0 application which will in essence shut down the application and disable any other pages from being requested.
我读过关于app_offline的文章。htm文件,它可以放置在。net 2.0应用程序的根目录中,在本质上,它将关闭应用程序并禁止任何其他页面被请求。
I've placed the file in the root, and my site still loads. I went into default documents in IIS and set it to app_offline.htm
and the site still loads (this might have been a caching issue though)
我已经将文件放在根目录中,并且我的站点仍然加载。我在IIS中进入默认文档并将其设置为app_offline。htm和站点仍在加载(这可能是缓存问题)
Anyway, has anyone run into issues using this? Am I doing something wrong?
不管怎么说,有人在使用它时遇到过问题吗?我做错什么了吗?
7 个解决方案
#1
131
I have used the extremely handy app_offline.htm trick to shut down/update sites in the past without any issues.
我使用了非常方便的app_offline。htm在过去关闭/更新站点时没有任何问题的技巧。
Be sure that you are actually placing the "app_offline.htm" file in the "root" of the website that you have configured within IIS.
确保您实际放置了“app_offline”。在IIS中配置的网站“根”中的htm文件。
Also ensure that the file is named exactly as it should be: app_offline.htm
还要确保文件的命名完全正确:app_offline.htm。
Other than that, there should be no other changes to IIS that you should need to make since the processing of this file (with this specific name) is handled by the ASP.NET runtime rather than IIS itself (for IIS v6).
除此之外,应该不需要对IIS进行任何其他更改,因为这个文件(具有这个特定名称)的处理是由ASP处理的。NET运行时而不是IIS本身(对于IIS v6)。
Be aware, however, that although placing this file in the root of your site will force the application to "shut down" and display the content of the "app_offline.htm" file itself, any existing requests will still get the real website served up to them. Only new requests will get the app_offline.htm content.
但是,请注意,尽管将该文件放在站点的根目录中,将迫使应用程序“关闭”并显示“app_offline”的内容。htm"文件本身,任何现有的请求仍然会得到真正的网站服务到他们。只有新的请求才能使app_offline。htm内容。
If you're still having issues, try the following links for further info:
如果您仍然有问题,请尝试以下链接以获取更多信息:
斯科特·顾的App_Offline.htm
App_Offline.htm and working around the "IE Friendly Errors" feature
App_Offline。htm和解决“IE友好错误”特性
Will app_offline.htm stop current requests or just new requests?
将app_offline。htm停止当前请求还是仅仅停止新的请求?
#2
41
Make sure your app_offline.htm file is at least 512 bytes long. A zero-byte app_offline.htm will have no effect.
确保你的app_offline。htm文件至少有512字节长。app_offline为0字节。htm不会产生任何影响。
UPDATE: Newer versions of ASP.NET/IIS may behave better than when I first wrote this.
更新:新版本的ASP。NET/IIS的行为可能比我第一次编写时更好。
UPDATE 2: If you are using ASP.NET MVC, add the following to web.config:
更新2:如果你正在使用ASP。NET MVC,添加以下内容到web.config:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
#3
13
Note that this behaves the same on IIS 6 and 7.x, and .NET 2, 3, and 4.x.
注意,它在IIS 6和7上的行为是相同的。还有。net 2 3 4。
Also note that when app_offline.htm is present, IIS will return this http status code:
还要注意,当app_offline时。htm存在,IIS将返回此http状态码:
HTTP/1.1 503 Service Unavailable
This is all by design. This allows your load balancer (or whatever) to see that the server is off line.
这都是设计出来的。这允许您的负载均衡器(或其他)看到服务器离线。
#4
9
Possible Permission Issue
可能的权限问题
I know this post is fairly old, but I ran into a similar issue and my file was spelled correctly.
我知道这篇文章很老,但我遇到了一个类似的问题,我的文件拼写正确。
I originally created the app_offline.htm file in another location and then moved it to the root of my application. Because of my setup I then had a permissions issue.
我最初创建app_offline。htm文件在另一个位置,然后将其移动到应用程序的根。由于我的设置,我有一个权限问题。
The website acted as if it was not there. Creating the file within the root directory instead of moving it, fixed my problem. (Or you could just fix the permission in properties->security)
这个网站表现得好像根本不存在。在根目录中创建文件而不是移动它,解决了我的问题。(也可以只修改属性中的权限—>安全性)
Hope it helps someone.
希望它能帮助一些人。
#5
2
Make sure that app_offline.htm
is in the root of the virtual directory or website in IIS.
确保app_offline。htm位于IIS中的虚拟目录或网站的根目录中。
#6
1
Make sure filename extensions are visible in explorer and filename is actually
确保在资源管理器和文件名中可以看到文件名扩展。
app_offline.htm
app_offline.htm
not
不
app_offline.htm.htm
app_offline.htm.htm
#7
0
I ran into an issue very similar to the original question that took me a little while to resolve.
我遇到了一个问题,和我花了一段时间才解决的最初问题非常相似。
Just incase anyone else is working on an MVC application and finds their way into this thread, make sure that you have a wildcard mapping to the appropriate .Net aspnet_isapi.dll defined. As soon as I did this, my app_offline.htm started behaving as expected.
如果其他人正在使用MVC应用程序并找到进入这个线程的方法,请确保您有到相应的。net aspnet_isapi的通配符映射。dll定义。一旦我这样做了,我的app_offline。htm开始像预期的那样行事。
IIS 6 Configuration Steps
On IIS Application Properties, select virtual Directory tab.
在IIS应用程序属性中,选择virtual Directory选项卡。
Under Application Settings, click the Configuration button.
在应用程序设置下,单击Configuration按钮。
Under Wildcard application maps, click the Insert button.
在通配符应用程序映射下,单击Insert按钮。
Enter C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll, click OK.
输入Microsoft.NET C:\WINDOWS\ \ Framework64 \ v4.0.30319 \ aspnet_isapi。dll,单击OK。
#1
131
I have used the extremely handy app_offline.htm trick to shut down/update sites in the past without any issues.
我使用了非常方便的app_offline。htm在过去关闭/更新站点时没有任何问题的技巧。
Be sure that you are actually placing the "app_offline.htm" file in the "root" of the website that you have configured within IIS.
确保您实际放置了“app_offline”。在IIS中配置的网站“根”中的htm文件。
Also ensure that the file is named exactly as it should be: app_offline.htm
还要确保文件的命名完全正确:app_offline.htm。
Other than that, there should be no other changes to IIS that you should need to make since the processing of this file (with this specific name) is handled by the ASP.NET runtime rather than IIS itself (for IIS v6).
除此之外,应该不需要对IIS进行任何其他更改,因为这个文件(具有这个特定名称)的处理是由ASP处理的。NET运行时而不是IIS本身(对于IIS v6)。
Be aware, however, that although placing this file in the root of your site will force the application to "shut down" and display the content of the "app_offline.htm" file itself, any existing requests will still get the real website served up to them. Only new requests will get the app_offline.htm content.
但是,请注意,尽管将该文件放在站点的根目录中,将迫使应用程序“关闭”并显示“app_offline”的内容。htm"文件本身,任何现有的请求仍然会得到真正的网站服务到他们。只有新的请求才能使app_offline。htm内容。
If you're still having issues, try the following links for further info:
如果您仍然有问题,请尝试以下链接以获取更多信息:
斯科特·顾的App_Offline.htm
App_Offline.htm and working around the "IE Friendly Errors" feature
App_Offline。htm和解决“IE友好错误”特性
Will app_offline.htm stop current requests or just new requests?
将app_offline。htm停止当前请求还是仅仅停止新的请求?
#2
41
Make sure your app_offline.htm file is at least 512 bytes long. A zero-byte app_offline.htm will have no effect.
确保你的app_offline。htm文件至少有512字节长。app_offline为0字节。htm不会产生任何影响。
UPDATE: Newer versions of ASP.NET/IIS may behave better than when I first wrote this.
更新:新版本的ASP。NET/IIS的行为可能比我第一次编写时更好。
UPDATE 2: If you are using ASP.NET MVC, add the following to web.config:
更新2:如果你正在使用ASP。NET MVC,添加以下内容到web.config:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
#3
13
Note that this behaves the same on IIS 6 and 7.x, and .NET 2, 3, and 4.x.
注意,它在IIS 6和7上的行为是相同的。还有。net 2 3 4。
Also note that when app_offline.htm is present, IIS will return this http status code:
还要注意,当app_offline时。htm存在,IIS将返回此http状态码:
HTTP/1.1 503 Service Unavailable
This is all by design. This allows your load balancer (or whatever) to see that the server is off line.
这都是设计出来的。这允许您的负载均衡器(或其他)看到服务器离线。
#4
9
Possible Permission Issue
可能的权限问题
I know this post is fairly old, but I ran into a similar issue and my file was spelled correctly.
我知道这篇文章很老,但我遇到了一个类似的问题,我的文件拼写正确。
I originally created the app_offline.htm file in another location and then moved it to the root of my application. Because of my setup I then had a permissions issue.
我最初创建app_offline。htm文件在另一个位置,然后将其移动到应用程序的根。由于我的设置,我有一个权限问题。
The website acted as if it was not there. Creating the file within the root directory instead of moving it, fixed my problem. (Or you could just fix the permission in properties->security)
这个网站表现得好像根本不存在。在根目录中创建文件而不是移动它,解决了我的问题。(也可以只修改属性中的权限—>安全性)
Hope it helps someone.
希望它能帮助一些人。
#5
2
Make sure that app_offline.htm
is in the root of the virtual directory or website in IIS.
确保app_offline。htm位于IIS中的虚拟目录或网站的根目录中。
#6
1
Make sure filename extensions are visible in explorer and filename is actually
确保在资源管理器和文件名中可以看到文件名扩展。
app_offline.htm
app_offline.htm
not
不
app_offline.htm.htm
app_offline.htm.htm
#7
0
I ran into an issue very similar to the original question that took me a little while to resolve.
我遇到了一个问题,和我花了一段时间才解决的最初问题非常相似。
Just incase anyone else is working on an MVC application and finds their way into this thread, make sure that you have a wildcard mapping to the appropriate .Net aspnet_isapi.dll defined. As soon as I did this, my app_offline.htm started behaving as expected.
如果其他人正在使用MVC应用程序并找到进入这个线程的方法,请确保您有到相应的。net aspnet_isapi的通配符映射。dll定义。一旦我这样做了,我的app_offline。htm开始像预期的那样行事。
IIS 6 Configuration Steps
On IIS Application Properties, select virtual Directory tab.
在IIS应用程序属性中,选择virtual Directory选项卡。
Under Application Settings, click the Configuration button.
在应用程序设置下,单击Configuration按钮。
Under Wildcard application maps, click the Insert button.
在通配符应用程序映射下,单击Insert按钮。
Enter C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll, click OK.
输入Microsoft.NET C:\WINDOWS\ \ Framework64 \ v4.0.30319 \ aspnet_isapi。dll,单击OK。