You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地MVC应用配置Azure Application Insight触发无明细应用错误

.NET MVC项目配置Azure Application Insight本地运行报错排查方案
  • 检查配置密钥拼写
    注意正确的配置键名为InstrumentationKey,而非拼写错误的InstrumentalKey,请核对ApplicationInsights.config或Web.config中的键名是否准确。
  • 调整NuGet包版本适配
    VS2017/2019配套的.NET Framework 4.x系列框架不兼容Application Insights 3.x以上版本,建议将Microsoft.ApplicationInsights.Web NuGet包降级至2.21.0稳定版,移除所有3.x版本的AI相关依赖包。
  • 核对Web.config模块注册配置
    确保Web.config中正确注册AI的HTTP模块,配置参考如下:
    <system.web>
      <httpModules>
        <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
      </httpModules>
    </system.web>
    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">
        <remove name="ApplicationInsightsWebTracking" />
        <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
      </modules>
    </system.webServer>
    
  • 调整配置文件属性
    右键选中项目中的ApplicationInsights.config文件,将「复制到输出目录」属性设置为「如果较新则复制」,避免运行时加载不到配置文件触发异常。
  • 开启本地开发者模式调试
    在ApplicationInsights.config的TelemetryChannel节点下开启开发者模式,跳过生产环境校验逻辑方便排查:
    <TelemetryChannel>
      <DeveloperMode>true</DeveloperMode>
    </TelemetryChannel>
    
  • 避免重复配置冲突
    不要同时配置InstrumentationKey和AI连接字符串,二选一即可,优先使用连接字符串的配置方式兼容性更好。

内容的提问来源于stack exchange,提问作者UliKunkelUSA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 10:15:07