如何在Azure中使用IIS app_offline.htm文件

时间:2021-03-29 02:02:18

I have a brilliantly designed app_offline.htm file that I'd like to display on my site periodically when I'm doing things like backing up the DB. On a server with a real file system, this wouldn't be a problem: I'd just copy app_offline.htm to the my app's root, and IIS will work its magic and redirect all requests to this file.

我有一个出色的app_offline.htm文件,当我正在做备份数据库时,我想定期在我的网站上显示这个文件。在具有真实文件系统的服务器上,这不是问题:我只是将app_offline.htm复制到我的应用程序的根目录,IIS将发挥其魔力并将所有请求重定向到此文件。

However, I'm using Azure, so there's no real file system and there's no easy way move files around from one location to another.

但是,我使用Azure,因此没有真正的文件系统,并且没有简单的方法将文件从一个位置移动到另一个位置。

How I can I make app_offline.htm play nicely with Azure?

我怎样才能使app_offline.htm与Azure很好地配合?

3 个解决方案

#1


5  

Actually there is a real file system, as each VM instance runs on Windows 2008 Server (SP2 or R2 SP1). To see this for yourself, enable Remote Desktop for your deployment and connect to a running instance.

实际上有一个真实的文件系统,因为每个VM实例都在Windows 2008 Server(SP2或R2 SP1)上运行。要自己查看此内容,请为部署启用远程桌面并连接到正在运行的实例。

Knowing this, you should be able to set up a mechanism to perform a file-copy of your app_offline.htm to your app root based on some type of administrative command. You'll just need to make sure each of your web role instances perform this action.

知道这一点,您应该能够设置一种机制,根据某种类型的管理命令,将app_offline.htm的文件副本执行到您的应用程序根目录。您只需要确保每个Web角色实例都执行此操作。

#2


5  

I figured I'd add this, I haven't seen it mentioned yet. You can actually do this via web publish from Visual Studio (or WebMatrix) as well, just put app_offline.htm in the root of your project - the same level as your main web.config. When done, just rename it and redeploy to go back online. 2 clicks - easy.

我想我会加上这个,我还没有看到它提到过。您实际上也可以通过Visual Studio(或WebMatrix)的Web发布来完成此操作,只需将app_offline.htm放在项目的根目录中 - 与主web.config相同。完成后,只需将其重命名并重新部署即可重新上线。 2次点击 - 很简单。

The manual option is to drop it into your /site/wwwroot via FTP.

手动选项是通过FTP将其放入/ site / wwwroot。

A little personal secret, none of your site files will be accessible, style sheets etc. So put your includes into an azure blob container, and viola.

一个小小的秘密,你的网站文件都不会被访问,样式表等等。所以把你的包括放入一个天蓝色的blob容器和中提琴。

#3


2  

David has provided you with a good answer. However, you might be missing out on what Azure can do for you. You should be able to virtually eliminate down time with Azure by running multiple instances and using SQL Azure which is triple backed up for you. You can also backup SQL Azure using http://msdn.microsoft.com/en-us/library/ff951624.aspx

大卫为你提供了一个很好的答案。但是,您可能会错过Azure可以为您做的事情。您应该能够通过运行多个实例并使用三重备份的SQL Azure来实际消除Azure的停机时间。您还可以使用http://msdn.microsoft.com/en-us/library/ff951624.aspx备份SQL Azure

#1


5  

Actually there is a real file system, as each VM instance runs on Windows 2008 Server (SP2 or R2 SP1). To see this for yourself, enable Remote Desktop for your deployment and connect to a running instance.

实际上有一个真实的文件系统,因为每个VM实例都在Windows 2008 Server(SP2或R2 SP1)上运行。要自己查看此内容,请为部署启用远程桌面并连接到正在运行的实例。

Knowing this, you should be able to set up a mechanism to perform a file-copy of your app_offline.htm to your app root based on some type of administrative command. You'll just need to make sure each of your web role instances perform this action.

知道这一点,您应该能够设置一种机制,根据某种类型的管理命令,将app_offline.htm的文件副本执行到您的应用程序根目录。您只需要确保每个Web角色实例都执行此操作。

#2


5  

I figured I'd add this, I haven't seen it mentioned yet. You can actually do this via web publish from Visual Studio (or WebMatrix) as well, just put app_offline.htm in the root of your project - the same level as your main web.config. When done, just rename it and redeploy to go back online. 2 clicks - easy.

我想我会加上这个,我还没有看到它提到过。您实际上也可以通过Visual Studio(或WebMatrix)的Web发布来完成此操作,只需将app_offline.htm放在项目的根目录中 - 与主web.config相同。完成后,只需将其重命名并重新部署即可重新上线。 2次点击 - 很简单。

The manual option is to drop it into your /site/wwwroot via FTP.

手动选项是通过FTP将其放入/ site / wwwroot。

A little personal secret, none of your site files will be accessible, style sheets etc. So put your includes into an azure blob container, and viola.

一个小小的秘密,你的网站文件都不会被访问,样式表等等。所以把你的包括放入一个天蓝色的blob容器和中提琴。

#3


2  

David has provided you with a good answer. However, you might be missing out on what Azure can do for you. You should be able to virtually eliminate down time with Azure by running multiple instances and using SQL Azure which is triple backed up for you. You can also backup SQL Azure using http://msdn.microsoft.com/en-us/library/ff951624.aspx

大卫为你提供了一个很好的答案。但是,您可能会错过Azure可以为您做的事情。您应该能够通过运行多个实例并使用三重备份的SQL Azure来实际消除Azure的停机时间。您还可以使用http://msdn.microsoft.com/en-us/library/ff951624.aspx备份SQL Azure