.Net On Premise Web应用程序的Azure应用程序见解-快速脉冲不可用

时间:2019-03-27 13:01:01

标签: c# azure azure-application-insights

我们为现有的Asp.Net MVC应用程序创建了一个Azure应用程序见解,我能够看到实时指标流上的快速脉搏和已连接的服务器。我仅使用一个与所有较低环境连接的工具密钥。正在返回太多服务器正在向该应用程序报告。此视图中不会显示其他服务器。

如果我们检查了遥测样本,就会发现错误率低于

AI (Internal): [Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse] Unexpected error in QuickPulse infrastructure: System.InvalidOperationException: Can't start collection while it is already running.
 at Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor.Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.IQuickPulseTelemetryProcessor.StartCollection(IQuickPulseDataAccumulatorManager accumulatorManager, Uri serviceEndpoint, TelemetryConfiguration configuration, Boolean disableFullTelemetryItems)
 at Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule.OnStartCollection()
 at Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.Implementation.QuickPulse.QuickPulseCollectionStateManager.UpdateState(String instrumentationKey, String authApiKey)
 at Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule.StateThreadWorker(CancellationToken cancellationToken). QuickPulse data will not be available.

不是在gloabl.asax Begin请求中的c#代码下面尝试过默认脚本。

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
        TelemetryConfiguration configuration = new TelemetryConfiguration();
        configuration.InstrumentationKey = System.Configuration.ConfigurationManager.AppSettings["instrumentationKey"];
        QuickPulseTelemetryProcessor processor = null;

        configuration.TelemetryProcessorChainBuilder
            .Use((next) =>
            {
                processor = new QuickPulseTelemetryProcessor(next);
                return processor;
            })
            .Build();

        var QuickPulse = new QuickPulseTelemetryModule();
        QuickPulse.Initialize(configuration);
        QuickPulse.RegisterTelemetryProcessor(processor);
    }

由于此问题,大多数时候并没有很快得到解决,请帮助我们查找问题。

1 个答案:

答案 0 :(得分:0)

您提到在Begin请求中有此代码。我认为您不想为每个请求调用此代码。您应该在Global Application_Start中完成该操作。