azure - Azure Application Insights 与 Google 搜索之间的 IP 地址不匹配

标签 azure azure-web-app-service google-search azure-application-insights azure-app-service-plans

为什么 Azure Application Insights 报告的 IP 地址与标准 Google 搜索(我的 IP 是什么)报告的 IP 地址之间存在差异

  • Azure App Insights 返回的 IP:xx.xx.xx.0
  • Google 搜索返回的 IP:xx.xx.xx.242

最佳答案

Application Insights 使用 IP 获取地理位置信息(例如国家/地区和城市),然后出于隐私原因丢弃 IP 的最后一个八位字节。

如果从 IP 中提取的地理位置信息不足以满足您想要解决的场景,并且您仍然希望/需要发送未屏蔽的 IP,则需要使用应用程序将其作为遥测项目的自定义属性提交见解 SDK。您可以使用Telemetry Initializer来做到这一点。

public class CopyIPTelemetryInitializer : ITelemetryInitializer
{
    public void Initialize(ITelemetry telemetry)
    {
        if (!string.IsNullOrEmpty(telemetry.Context.Location.Ip))
        {
            telemetry.Context.Properties["client-ip"] = telemetry.Context.Location.Ip;
        }
    }
}

关于azure - Azure Application Insights 与 Google 搜索之间的 IP 地址不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42429148/

相关文章:

azure - 如何检索 Azure 搜索索引的内容?

c# - 是否可以通过编程方式扩展 Azure 应用服务

azure - 将azure Web应用程序添加到应用程序服务环境中

seo - 改善我网站的搜索引擎优化

seo - AMP 故事在 Google AMP 验证中被标记为 noindex,但 AMP Story 中没有 noindex 标签

HTML 元标记未更改搜索引擎中的描述片段(Google/Bing)

azure - 发布管道无权执行操作 'Microsoft.Web/sites/config/list/action'

azure - 是否可以在 Azure 中设置一个连接到多个本地数据库的 Web 应用程序?

azure - 使用门户更改 Azure 应用程序设置,无需重新启动

azure - 如何将数据库从 azure sql server 移动到虚拟机?