Create a web application and config Application Insights.
Telemetry initializer
1 | using Microsoft.ApplicationInsights.Channel; |
- Enable telemetry initializer for ASP.NET
1 | using Microsoft.ApplicationInsights.Extensibility; |
- Sending sample HTTP requests with X-Forwarded-For header or your custom header
1 | Invoke-WebRequest "https://jackywin3.azurewebsites.net/About" -Method GET -Headers @{"X-Forwarded-For" = "1.1.0.1"} |
- View the results of your telemetry initializer
If you send new traffic to your site, and wait a few minutes. You can then run a query to confirm collection is working:
requests
| where timestamp > ago(1h)
| project appName, operation_Name, url, resultCode, client_IP, customDimensions.[“client-ip”]
For more information: https://docs.microsoft.com/en-us/azure/azure-monitor/app/ip-collection?tabs=net
Enjoy. 2020-9-23 By Jacky