Azure Application Insights-如何排除本地主机

Azure Application Insights-如何排除本地主机,azure,azure-web-app-service,azure-application-insights,Azure,Azure Web App Service,Azure Application Insights,我已经通过标准方式将应用程序洞察添加到我的应用程序中,它运行良好,我从本地网站和发布在Azure上的工作项目中收集遥测数据。但是有很多数据是从localhost发送的,我怎么能说不从localhost发送任何数据呢?谢谢正如Brendan所说,您可以在本地主机上的ApplicationInsights.config中删除InstrumentationKey,并仅将其设置为代码中的发布版本: TelemetryConfiguration.Active.instrumentationkey=“MyK

我已经通过标准方式将应用程序洞察添加到我的应用程序中,它运行良好,我从本地网站和发布在Azure上的工作项目中收集遥测数据。但是有很多数据是从localhost发送的,我怎么能说不从localhost发送任何数据呢?谢谢

正如Brendan所说,您可以在本地主机上的ApplicationInsights.config中删除
InstrumentationKey
,并仅将其设置为代码中的发布版本:
TelemetryConfiguration.Active.instrumentationkey=“MyKey”

此外,您还可以通过如上所述设置以下代码来禁用遥测功能


有关如何在Application Insights上忽略localhost的更多详细信息,您可以参考此内容。

从本地配置中删除
,并仅将其添加到Azure上已发布的应用程序中。当您使用Azure网站时,您可以使用门户覆盖
app.settings
值。您可以通过设置TelemetryConfiguration.Active.DisableTelemetry=true@JoeyCai,但它完全禁用了人工智能。。。
TelemetryConfiguration.Active.DisableTelemetry = true;