【问题标题】:ApplicationInsights TelemetryClient is very slow at initializing when in DebugApplicationInsights TelemetryClient 在调试时初始化非常慢
【发布时间】:2018-02-16 10:36:49
【问题描述】:

我对@9​​87654325@ 对象有疑问。每次代码第一次遇到其中一个对象时,初始化时间都非常长(有时甚至大约 40 秒)。

示例 1:

示例 2:

第一次加载这么长的原因是什么?我该如何解决这个问题?

【问题讨论】:

    标签: c# azure-application-insights


    【解决方案1】:

    在使用 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>
    

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

    【讨论】:

    • 谢谢,我刚刚禁用了它 - 我的应用启动得更快了。
    • 我怀疑在正常调试会话期间会触发转换?!
    • @FalcoAlexander - 试试...确实如此。
    • 我试过了,它仍然会触发 Insight 事件。即使我必须添加:&lt;system.webServer&gt; &lt;modules&gt; &lt;add xdt:Transform="Remove" xdt:Locator="Match(name)" name="TelemetryCorrelationHttpModule" /&gt; &lt;/modules&gt; &lt;/system.webServer&gt;
    • 还必须添加 &lt;system.diagnostics&gt; &lt;trace&gt; &lt;listeners&gt; &lt;add xdt:Transform="Remove" xdt:Locator="Match(name)" name="myAppInsightsListener" /&gt; &lt;/listeners&gt; &lt;/trace&gt; &lt;/system.diagnostics&gt;...现在很安静 :) @LeonardoSeccia 将其添加到您的答案中怎么样?
    猜你喜欢
    • 2018-03-27
    • 2011-10-27
    • 1970-01-01
    • 2011-02-24
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    • 1970-01-01
    • 2022-06-15
    相关资源
    最近更新 更多