我刚刚在 MVC 应用程序中启用了 Application Insights,并注意到在本地调试时,跟踪信息会在我的 Azure Application Insight 中捕获。
处于调试模式时,我想阻止应用程序在 Azure Application Insight 中记录事件,但仍会在 Visual Studio 的“诊断工具”>“事件”窗口中显示事件和日志记录信息。
我已尝试以下操作,虽然这会阻止在我的 Azure AI 中捕获事件,但 Visual Studio 不再在“事件”窗口中显示调试信息。
protected void Application_Start()
{
#if DEBUG
TelemetryConfiguration.Active.DisableTelemetry = true;
#endif
}
Run Code Online (Sandbox Code Playgroud)
我上网寻找答案无济于事。希望有人能帮忙。