I have two web applications under IIS 7 (local Windows 10 Pro). At the root is an MVC .Net Version 4.7.1. Everything seems to work fine here so far. However, set up as a separate application under the default site root is an older .Net Version 4.0 WebForms application.
The version 4 application is built in Visual Studio 2015 and the MVC is built using Visual Studio 2017. I have the version 4 WebForms app running under a different website with the same settings and it runs fine. It only has a problem when running under the root node as a different application. Also I have tried using different App Pools on both application as well as using the same App Pool with no change in the error.
I have also tried uninstalling ApplicationInsights and disabling it and I get the same issue.
[FileNotFoundException: Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified.] System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +95 System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +64 System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +60 System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +49
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified.] System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +558 System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +30 System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +57 System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +57 System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +182 System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1086 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +120 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +169 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +372 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +329
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +708
In my case, sub app wasn't using ApplicationInsights and I added these exclusions to the sub app web.config file. It fixed the problem.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="false">
<remove name="TelemetryCorrelationHttpModule" />
<remove name="ApplicationInsightsWebTracking" />
</modules>
</system.webServer>
</configuration>
Here is the discussing topic where I have found my answer https://github.com/aspnet/Microsoft.AspNet.TelemetryCorrelation/issues/21#issuecomment-508535397
My answer is a late answer but it might help someone else.
You can use NugetPackage Manager and browse for Microsoft.AspNet.TelemetryCorrelation
and install it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With