This is a tough question to ask... so I'll try to describe the contours of the situation as best I can:
I have a WCF service that uses the AI Console implementation I've followed from: //https://docs.microsoft.com/en-us/azure/azure-monitor/app/console/
Sample code:
string applicationInsightsConnectionString = ConfigurationManager.AppSettings["ApplicationInsightsConnectionString"];
TelemetryConfiguration configuration = TelemetryConfiguration.CreateDefault();
configuration.ConnectionString = applicationInsightsConnectionString;
var telemetryClient = new TelemetryClient(configuration);
The global.asax calls telemetryClient.TrackTrace("application start");
on app start and this is the simplest example of what I wish to see in AI.
When running this code locally through visual studio and giving it 30 seconds to flush I get a result in AI:
[![enter image description here][1]][1]
Sadly when I deploy this code to the server to run in IIS I do not get any records to show up in AI.
What puzzles me even more is that this is the 3rd implementation I've done in the exact same way (all WCF services running in IIS), yet this is the only one that does not record any results in the azure portal eventhough it works locally.
I've triple checked the web.config if it has the correct connectionstring and I've added test code to check if the calls succeed by writing simple test lines to the database... everything seems fine.
Any idea's what else I can check to get this to work? I am kind of stuck as I can not think of a next action to get to a solution.
Many thanks, Davey
CodePudding user response:
After some debugging with WireShark I found that the calls to applications insights were in TSL1.0, not TSL1.2 and therefore not accepted.
After adding
protected void Application_Start(object sender, EventArgs e)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
}
To the global.asax.cs
The calls were in TSL1.2 and they arrived in azure :)
(Adding the following to the web.config also works)
<system.web>
<httpRuntime targetFramework="4.7.2"/>
</system.web>