无法加载文件或程序集“Microsoft.AspNet.TelemetryCorrelation”或其依赖项之一。该系统找不到指定的文件

sta*_*ley 8 .net c# asp.net asp.net-mvc

我在 IIS 7(本地 Windows 10 Pro)下有两个 Web 应用程序。根是 MVC .Net 版本 4.7.1。到目前为止,这里似乎一切正常。但是,在默认站点根目录下设置为单独的应用程序是较旧的 .Net 版本 4.0 WebForms 应用程序。

第 4 版应用程序是在 Visual Studio 2015 中构建的,MVC 是使用 Visual Studio 2017 构建的。我有第 4 版 WebForms 应用程序在具有相同设置的不同网站下运行,并且运行良好。只有在根节点下作为不同的应用程序运行时才会出现问题。此外,我尝试在两个应用程序上使用不同的应用程序池以及使用相同的应用程序池而错误没有变化。

我也试过卸载 ApplicationInsights 并禁用它,但我遇到了同样的问题。

[FileNotFoundException: 无法加载文件或程序集“Microsoft.AspNet.TelemetryCorrelation”或其依赖项之一。系统找不到指定的文件。] System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, BooleanreflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, BooleanreflectionOnly, 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。

[ConfigurationErrorsException: 无法加载文件或程序集“Microsoft.AspNet.TelemetryCorrelation”或其依赖项之一。系统找不到指定的文件。] 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。

[HttpException (0x80004005): 无法加载文件或程序集“Microsoft.AspNet.TelemetryCorrelation”或其依赖项之一。系统找不到指定的文件。] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) + 708

boy*_*bas 9

就我而言,子应用程序没有使用 ApplicationInsights,我将这些排除项添加到子应用程序web.config文件中。它解决了这个问题。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="false">
      <remove name="TelemetryCorrelationHttpModule" />
      <remove name="ApplicationInsightsWebTracking" />
    </modules> 
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

这是我找到答案的讨论主题https://github.com/aspnet/Microsoft.AspNet.TelemetryCorrelation/issues/21#issuecomment-508535397

我的答案是一个迟到的答案,但它可能会帮助其他人。


小智 0

斯坦利.

如果我理解正确的话,我会推荐以下内容:

导航到完美运行的 WebForms 实例。在该目录中搜索包含“遥测”一词的文件。您应该找到几个 .dll。

在 WebForms 目录中执行相同的搜索,但不起作用。你应该找到notice或less文件。

我会将“遥测”文件从工作实例复制到损坏的实例(匹配目录),然后看看会发生什么。!?

根据错误,代码尝试加载丢失的文件。--无法加载文件或程序集。(FileNotFoundException)