如何使Azure Traffic Manager用作两个Web应用程序的故障转移?

如何使Azure Traffic Manager用作两个Web应用程序的故障转移?

问题描述:

我在Azure中设置了两个Web应用程序.在生产中进行任何操作之前,我现在只是使用它来测试Traffic Manager,因此我创建了两个假"应用程序来进行试用.

I set up two web apps in Azure. I'm just using this to test out Traffic Manager for now before I do anything in production, so I created two "fake" apps to try it out.

我在以下URL上向门户网站添加了流量管理器:

I added a Traffic Manager to the portal at the following URL:

http://mbfakesite.trafficmanager.net

我将端点1列为第一个Web应用程序,将端点2列为第二个Web应用程序,并且我使用的是Priority方法.

I listed endpoint 1 as the first web app, and endpoint 2 as the second, and I am using the Priority method.

当我停止Azure中的第一个Web应用程序并转到trafficmanager URL时,出现403错误页面.我想发生的事情是默认使用第二个端点.

When I stop the first web app in Azure, and go to the trafficmanager URL, I get a 403 error page. What I want to happen is it to default to the second endpoint.

最终目标是让MVC应用程序在与生产网站不同的服务器上运行.并且当生产服务器停机(备份和全部)时,它应该默认为在单独的服务器上运行的故障保护"应用程序,例如最坏情况的事情.

The end goal is to have an MVC app running on a different server than the production website. And when, the production servers are down (backups and all) it should default to this "failsafe" app running on a separate server, like a worst-case scenario type of thing.

如果有所不同,则两个要测试的Web应用程序都托管在azurewebsites.net上,并且在Traffic Manager中,一个被列为Azure端点(第一个),另一个被列为外部端点.

If it makes a different, both web apps for testing are hosted at azurewebsites.net and in Traffic Manager, one is listed as an Azure Endpoint (the first one) and the other is listed as an External Endpoint.

我也尝试添加到web.config中,就像有人在我发现的另一篇文章中所建议的那样,但是它什么都没有改变.

I also tried adding to the web.config, as someone suggested on another post I found, but it changed nothing.

有人对我们可以使用的流量管理器有什么想法或替代方法吗?

Anyone have any ideas, or alternatives to Traffic Manager we could use for this?

谢谢!

尽管其他答案中给出的时间表大多是正确的,但它忽略了流量管理器操作的一些基本方面.

While the timeline given in the other answer is mostly correct, it overlooks some fundamental aspects of how Traffic Manager operates.

由于流量管理器仅更改DNS规则,因此只有在您的浏览器实际检查该规则时它才起作用.不幸的是,现代网络通信具有许多快捷方式,其中一种被称为保持活动".

Since Traffic Manager only changes DNS rules, it only works if your browser actually checks that rule. Unfortunately, modern web communication has numerous shortcuts, and one is known as "keep-alive".

在我走得更远之前,我找到的解决您症状的方法是

Before I go further, the solution I found for your symptoms is to

  1. 远程进入您的节点
  2. 打开IIS管理器
  3. 在"IIS"下打开"HTTP响应标头"
  4. 单击右侧的设置通用标题",然后取消选中保持活动"选项

请提前警告,这将导致点击量增加.基本上,这需要浏览器检查DNS规则并在每个连接上打开一个新连接.这是必需的,因为这些打开的连接可以在TTL持续时间和所有DNS缓存破坏的情况下幸存下来.确实,可以通过单击刷新来进一步扩展这些开放的连接.与您想要的完全相反.

Be forewarned, this will result in a higher number of hits to the Traffic Manager. Basically this requires a browser to check the DNS rule and open a new connection on each connection. This is needed because these open connections can survive PAST the TTL duration and any DNS cache destruction. Indeed, it's possible to extend these open connections further by hitting refresh. The exact opposite of what you want.

我知道这个答案可能对您来说太晚了,因此我深表歉意.但是,我认为这应该得到答案.

I know this answer is probably far too late for your use, so I apologize. However, I think it deserves an answer.