简体   繁体   English

如何为Windows Azure网站实施“维护中的站点”?

[英]How do you implement “Site under maintenance” for Windows Azure Web Site?

In one of our ASP.NET Web site solutions I need to roll out an update that might take reasonable time. 在我们的一个ASP.NET网站解决方案中,我需要推出可能需要合理时间的更新。 It spawns multiple Windows Azure Workers and projects and so simple Deployment Swap is ruled out. 它产生了多个Windows Azure Workers和项目,因此排除了简单的部署交换。

Essentially I'm just thinking about way to redirect all web requests to a "site is under maintenance" page for some time , given the project is under Windows Azure . 基本上我只是考虑将所有Web请求重定向到“站点正在维护”页面一段时间 ,因为该项目在Windows Azure下

I'm aware of the app-offline.htm trick with IIS, but I doubt that Azure Web Role will allow this one to be deployed or run (it spins down the app domain). 我知道使用IIS的app-offline.htm技巧,但我怀疑Azure Web角色是否允许部署或运行​​这个(它会在应用程序域中旋转)。

After some additional investigation, it seems that one of the implementation options is to create a separate web project (deployment package and the web role) that redirects all requests to the single maintenance page. 经过一些额外的调查后,似乎其中一个实现选项是创建一个单独的Web项目(部署包和Web角色),将所有请求重定向到单个维护页面。 Url Rewrite module (installed on Azure by default) could be configured like this: Url Rewrite模块(默认情况下安装在Azure上)可以像这样配置:

<rules>
  <rule name="Redirect exclusions" stopProcessing="true">
    <match url="\.(css|gif|png|htm|jpg)$" />
  </rule>
  <rule name="Redirect to index" stopProcessing="true">
    <match url="^(.*)$" />
    <action type="Redirect" url="/index.htm" />
  </rule>
</rules>

Deploying this project via the swap will ensure logical consistency, while the message details (if maintenance period is expected to be longer) could be passed through the cscfg settings. 通过交换部署此项目将确保逻辑一致性,而消息详细信息(如果预计维护期更长)可以通过cscfg设置传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM