简体   繁体   English

Azure设置内部URL的可用性测试

[英]Azure set up availability test of internal url

I have a public web app on which I can set up an availability test from Azure. 我有一个公共Web应用程序,可以在其上设置Azure的可用性测试。 I also have a private web app on which the availability test fails. 我也有一个私有Web应用程序,可用性测试失败。

I want to track the availability of my internal web app. 我想跟踪我的内部Web应用程序的可用性。 In C#, I have found until now: 在C#中,我发现到现在为止:

TelemetryConfiguration.Active.InstrumentationKey = "application insights key";
var telemetryClient = new TelemetryClient();
var avail = new Microsoft.ApplicationInsights.DataContracts.AvailabilityTelemetry();
telemetryClient.TrackAvailability(avail);

However this code is unfinished. 但是,此代码未完成。 I'm not sure how I would specify my internal url and where I would see the results. 我不确定如何指定内部网址以及在哪里可以看到结果。

For the internal web, first of all, you should make sure "allow traffic to our services by either firewall exceptions or proxy redirects.", detail is here . 对于内部网站,首先,请确保“允许通过防火墙例外或代理重定向来访问我们的服务。”,详细信息在此处

Then just a simple line of code, just define some specific properties or name for your internal url in AvailabilityTelemetry. 然后只需编写简单的代码行,即可在AvailabilityTelemetry中为您的内部url定义一些特定的属性或名称。

            var client = new TelemetryClient();
            TelemetryConfiguration.Active.InstrumentationKey = "xxxxx";
            AvailabilityTelemetry a = new AvailabilityTelemetry();
            a.Name = "this is your_web_site_name or other unique value";

            //or some properties like below
            //a.Properties.Add("p1", "my internal web");

            client.TrackAvailability(a);

Then after execution, you can check if the availability telemetry is in azure portal -> your application insights service: 然后在执行之后,您可以检查可用性遥测是否在azure门户中->您的应用程序见解服务:

在此处输入图片说明

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

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