Sometimes you want to check that telemetry data is collected by Application Insights SDK and being sent to the endpoint. It is easy to do in Visual Studio - you will see JSON of telemetry items in debug window or use Fiddler to see data being sent by application running in IISEpress. However if your application is running in IIS under application pool identity or local system account Fiddler will not pick up events. It is also challenging to do when application is running in production environment and you don’t want to install fiddler there.
Here is how you can do it.
Install and configure reverse proxy. I’m using Fiddler as a reverse proxy. It is very simple to configure it. If you are troubleshooting production environment you can have fiddler on machine accessible from one running your application.
In my example I have fiddler on machine where my application is running. So I used this code snippet in OnBeforeRequest handler:
You may need to replace “localhost” to the name of machine running fiddler.
Redirect application Insights SDK traffic to this proxy. Here is a piece of XML you need to insert into ApplicationInsights.config file of your application. Note, this will work for application Insights SDK 0.12. It had different format for previous versions and may change in future:
1 2 3 4 5
Update: Please note, format of configuration file changed in 0.13 SDK. Now you should not specify “InPorcess” tag:
1 2 3
Again, if you are using different machine you will need to replace localhost to the name of machine running your proxy server (or fiddler in my case).
1 2 3 4
Now you can see all Application Insights telemetry in fiddler (or other reverse proxy tool).