测试具体的Azure网站实例 [英] Testing specific Azure Web Site Instance
问题描述
我必须配置为使用多个(2)情况下的Azure的网站:
I have an Azure Web Site configured to use multiple (2) instances:
我有实例之间应该传递消息的服务总线(IE缓存集中退出)。我需要测试这个机制。
I have a service bus that should pass messages (ie Cache Evict) between the instances. I need to test this mechanism.
在传统的系统(premise上)我将指向浏览器实例1(即的http:// MYSERVER1 .example.com的),执行一个动作,然后我的浏览器指向另一个实例(的http:// myserver2。 example.com )来测试。
In a conventional (on premise) system I would point a browser to instance 1 (ie http://myserver1.example.com), perform an action, then point my browser to the other instance (http://myserver2.example.com) to test.
不过,在Azure中我看不到的方式来打了一个具体的实例。可能吗?或者是有要通过这个测试场景中运行的替代方法(例如上1的行为,确保实例2的行为恰当)?
However, in Azure I can't see a way to hit a specific instance. Is it possible? Or is there an alternative way to to run through this test scenario (act on instance 1, ensure instance 2 behaves appropriately)?
推荐答案
不幸的是,不这样做的正式途径。但是,你可以通过你的要求设置一个名为cookie的 ARRAffinity
实现这一目标。
Unfortunately, there isn't an official way of doing this. However, you can achieve that by setting a cookie called ARRAffinity
on your request.
试着打从任何客户端(浏览器,火狐,卷曲,httpie等),您的网站并检查您取回响应头。
Try hitting your site from any client (Chrome, Firefox, curl, httpie, etc) and inspect the response headers that you are getting back.
例如在卷曲
你会怎么做。
curl -I <siteName>.azurewebsites.net
你会得到这个
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: text/html
Last-Modified: Wed, 17 Sep 2014 16:57:26 GMT
Accept-Ranges: bytes
ETag: "2ba0757598d2cf1:0"
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Set-Cookie: ARRAffinity=<very long hash>; Path=/;Domain=<siteName>.azurewebsites.net
Date: Fri, 28 Nov 2014 03:13:07 GMT
你有兴趣在什么 ARRAFinity
如果你发送请求的情侣,你会发现,哈希会不断变化,稀土present的两个实例值2之间
what you are interested in is the ARRAFinity
if you send couple of request you would notice that hash will keep changing between 2 values that represent your 2 instances.
设置,在您的要求你的饼干
头将保证它会其中一个实例,而不是其他。
Set that in your Cookie
header on your request will guarantee it going to one of the instances and not the other.
curl --cookie ARRAfinity=<one of the hashes you got> <siteName>.azurewebsites.net
这篇关于测试具体的Azure网站实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!