Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified

5

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

c#
asp.net
.net
asp.net-mvc
asked on Stack Overflow Jun 20, 2018 by stanley

5 Answers

2

I also face the same issue when i am working with an application inside the default website in iis. Please remove all .net files from root(in my case root is Default Web Site) then it will work.

answered on Stack Overflow Sep 20, 2018 by Prince Prasad
2

use nuget packege manager and brows Microsoft.AspNet.TelemetryCorrelation and install it

answered on Stack Overflow Jul 15, 2019 by Parvin Torkaman
1

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.

answered on Stack Overflow Aug 13, 2020 by boyukbas
0

Stanley.

If i understand you correctly, i would recommend the following:

Navigate to the WebForms instance that works perfectly. In that directory do a search for files that contain the word 'Telemetry'. You should find a couple of .dll's.

Do the same search in the WebForms directory that does NOT work. you should find noting or less files.

I would copy the 'Telemetry' files from the working instance to the broken instance(matching the directories) and see what happens. !?

As per the error the code its trying to load missing files. --could not load file or assembly.(FileNotFoundException)

answered on Stack Overflow Jun 20, 2018 by Pieter Alberts
0

So I found a SO Question that shows how to disable ApplicationInsights. Doing that did not actually fix the issue, but then I went in and removed all signs of it in Nuget packages and the config file at the root of my project. Once I got that done the error no longer occurs.

answered on Stack Overflow Jun 20, 2018 by stanley

User contributions licensed under CC BY-SA 3.0