.Net Application Insights 2.5 不跟踪 HTTP 请求

bli*_*izz 3 asp.net asp.net-mvc azure azure-application-insights

我有一个 ASP .Net MVC 应用程序,它使用 Application Insights 进行遥测跟踪。从任何具有 localhost 的开发人员机器调试应用程序时,它工作正常,但是当部署到我们的主开发环境 Web 服务器时,不再跟踪 HTTP 请求。

其他所有内容,包括异常、依赖项、跟踪,都被正确跟踪。但 HTTP 请求不是。我怎样才能找到这个问题的原因?我不知道从哪里开始。

我们正在使用 Application Insights SDK 2.5.0.61767。配置文件在所有机器上都是相同的。不知道还有什么可能导致它。欢迎任何建议。

编辑:我注意到它也没有收集服务器响应时间、服务器请求和失败的请求。

我在 ApplicationInsights.config 文件中有以下模块配置:

<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
  <Handlers>
    <!-- 
    Add entries here to filter out additional handlers: 

    NOTE: handler configuration will be lost upon NuGet upgrade.
    -->
    <Add>System.Web.Handlers.TransferRequestHandler</Add>
    <Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
    <Add>System.Web.StaticFileHandler</Add>
    <Add>System.Web.Handlers.AssemblyResourceLoader</Add>
    <Add>System.Web.Optimization.BundleHandler</Add>
    <Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
    <Add>System.Web.Handlers.TraceHandler</Add>
    <Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
    <Add>System.Web.HttpDebugHandler</Add>
  </Handlers>
</Add>
Run Code Online (Sandbox Code Playgroud)

bli*_*izz 5

将以下部分添加到我的web.config已经解决了我的问题。

<system.webServer>
  <modules>
      <add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler" />
      <add name="ApplicationInsightsHttpModule" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
  </modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)