I have an ASP.NET web application targeting .NET Framework 4.6.2 (VB.NET, not C#). I'm running it locally with IIS.
When I installed Microsoft.ApplicationInsights 2.21.0 using NuGet and re-loaded the site locally, I received a server error:
Server Error in '/' Application. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Three considerations:
I didn't change any code- I just installed the package.
The dependency tree NuGet installed for Microsoft.ApplicationInsights
2.21.0 in this project included:
System.Buffers.4.5.1
System.Numerics.Vectors.4.5.0
System.Runtime.CompilerServices.Unsafe.5.0.0
System.Memory.4.5.4
System.Diagnostics.DiagnosticSource 5.0.0
Microsoft.ApplicationInsights.2.21.0
None of those pre-existed in my project, so I'm certain I only installed new packages which shouldn't conflict or crossover with any pre-existing dependencies.
I tried wiping the bin and obj folders, and restarting IIS. Didn't help.
I configured NuGet to restore packages and deleted all of the packages in the solution and rebuilt it. That didn't help, either.
The project has deprecated packages. However, they have nothing to do with AppInsights, and I'd like to avoid a re-write if possible.
Generally, it seems like there is a dependency conflict within one or more dependency tree(s) that reference one or more assemblies in the GAC, but I have no clear way of identifying the tree(s) or fixing it/them.
How can I diagnose which package/assembly is causing this error if none of the new packages was referenced by any existing one?
Server Error in '/' Application. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
As you mentioned, the error could be due to the compatibility or conflicts between the error and also there must be some issues with the application code.
Try configuring Application Insights Manually, refer MSDOC:
project=>configure Application Insights
:Application Insights sdk
=>Next=>Finish=>Close
.ApplicationInsights.config
before the closing tag . <ConnectionString>your_application_insights_connection_string</ConnectionString>
</ApplicationInsights>
I tried installing the Application insights package version 2.21.0
in my .NET web application version 4.8 (vb.net).
I could run the application without any issues:
References of my project: