在调试中时,ApplicationInsights TelemetryClient初始化速度很慢

Ste*_*zor 5 c# azure-application-insights

我的Microsoft.ApplicationInsights物体有问题。每次代码第一次碰到这些对象中的一个,初始化时间就非常长(有时甚至是40秒左右)。

范例1:

首次初始化TelemetryClient

范例2:

禁用Telemtry

如此长的首次加载的原因是什么?我怎样才能解决这个问题?

Leo*_*cia 5

为什么在使用web.config转换进行调试时不只是禁用ApplicationInsight?

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.web>
      <httpModules>
        <add xdt:Transform="Remove" xdt:Locator="Match(name)" name="ApplicationInsightsWebTracking" />
      </httpModules>
  </system.web>
  <system.webServer>
    <modules>
      <add xdt:Transform="Remove" xdt:Locator="Match(name)" name="ApplicationInsightsWebTracking"  />
    </modules>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我遇到了类似的问题,这个问题的答案向我解释了如何在我的开发环境(即不在发布管道中)中使用此代码段。

  • 谢谢,我刚刚禁用了它-我的应用程序启动快得多。 (2认同)