Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.ApplicationInsights Error: InstrumentationKey cannot be empty

I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use

_telemetryClient.TrackException(ex, new Dictionary<string, string>
                                    {
                                         {"Id", id.ToString()}
                                    }, null);

I am getting an error saying: InstrumentationKey cannot be empty.

I have already gone through the URL but I can't see any Update menu available for the config file in my VS(Note: I am using VS 2012 Pro).

I have also tried updating the config file with the instrumentation key

<ComponentID>{Instrumentation Key}</ComponentID>

But, that didn't work too.

Thanks.

like image 405
sovan Avatar asked Sep 30 '22 08:09

sovan


1 Answers

Did you download nuget manually or did you get it via UI by adding AppInsights to the project? We have seen this issue when users try to add individual nugget manually.

The easiest way to recover is to add full AppInsights support by right click on the project and choosing Update Application Insights - it will ask you to create new AI resource or point to existing AI resource and it will create instrumentation key for you.

But you'd need to use VS 2013 in order to have VS integration for Application Insights.

like image 98
Anna Galaeva - MS Avatar answered Nov 15 '22 06:11

Anna Galaeva - MS