85
无法加载文件或程序集“Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。该模块应包含程序集清单。


从以下位置加载的程序集管理器:C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
在可执行文件 C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe 下运行
--- 详细的错误日志如下。

=== 预绑定状态信息 ===
日志:用户 = TTLWIN2K\miralp
日志:DisplayName = Microsoft.VisualStudio.Web.PageInspector.Loader,版本 = 1.0.0.0,文化 = 中性,PublicKeyToken = b03f5f7f11d50a3a
 (完全指定)
日志:Appbase = file:///C:/SVN/temp/components/src/MasterpassProxy/src/Webservice/
日志:初始 PrivatePath = C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\bin
调用程序集:(未知)。
===
LOG:此绑定在默认加载上下文中开始。
LOG:使用应用程序配置文件:C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\web.config
LOG:使用主机配置文件:
LOG:使用 C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config 中的机器配置文件。
日志:后策略参考:Microsoft.VisualStudio.Web.PageInspector.Loader,Version=1.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a
4

16 回答 16

189

我刚刚遇到了同样的问题,罪魁祸首是我卸载了Visual Studio Express 2012。它可能是 Visual Studio 的任何版本,因为对此答案的评论表明问题仍然存在于Visual Studio 2019中。我的总体操作顺序是:

  • 安装 Visual Studio Express 2012(很久以前)
  • 愉快地使用 Visual Studio Express 2012 好几个月
  • 已安装 Visual Studio 2013 高级版
  • 愉快地使用 Visual Studio 2013 Premium 数周
  • 已卸载 Visual Studio Express 2012
  • 错误

我不是 100% 确定它的原因,或者 Visual Studio 版本的哪些组合会表现出这种行为。但对我来说,解决方案是编辑web.config框架目录中的根文件:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

(对于不同的框架版本,您可能有不同的文件夹。)

并删除节点:

<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

小心不要删除与这些也位于同一行的任何打开/关闭父节点。

这为我解决了这个问题。

于 2014-04-24T16:17:06.003 回答
20

无需删除这些行
只需关闭并重新打开具有管理员权限的 Visual Studio 即可。

于 2016-04-20T07:25:44.090 回答
16

我遇到了同样的问题,但不是在我的开发机器上,而是在托管服务器上。

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

我可以通过将以下代码添加到我的 web.config 来修复它

<compilation targetFramework="4.5"> 
    <assemblies> 
        <remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </assemblies> 
</compilation>

或者通过从框架目录中的 web.config 文件中删除对该程序集的引用。

我从来没有在那里安装过 VS,也从来没有在那里安装过 PageInspector。知道为什么这些配置会引用它们吗?

于 2016-12-15T16:43:49.067 回答
6

Update: fixed in Visual Studio 2019 Version 16.0.3 according to this page.

If this happens after upgrading to Visual Studio 2019 RC, the following workaround helped:

  1. Find the download cache directory enter image description here
  2. Use Explorer or better to find the AspNetDiagnosticPack.msi within this directory.
  3. Run (double-click) the AspNetDiagnosticPack.msi file (this will force the installation of this MSI).

Workaround found here

于 2019-03-11T16:40:36.347 回答
3

安装Visual Studio 2019后我遇到了这个问题(虽然仍然安装了 2017)。它是由缺少的组件引起的AspNetDiagnosticPack.msi- 无法将所需的包安装到C:\ProgramData\Microsoft\VisualStudio\Packages\

对我有用的解决方案是:

  • 关闭 Visual Studio

  • 从以下位置下载软件包:

https://download.visualstudio.microsoft.com/download/pr/e13d544f-5a3c-4bb3-9a7c-1e56b1f90e10/f8e5888ff01a7009ef8c2ef16aa02ab9/aspnetdiagnosticpack.msi

  • 运行安装程序并安装。

这应该解决它。

可以找到更多信息:https ://developercommunity.visualstudio.com/content/problem/398640/could-not-load-file-or-assembly-microsoftvisualstu-7.html

于 2019-04-18T08:22:53.403 回答
2

对于那些可能最终出现在这里的人,请在调试时尝试在项目的 Web.Config 文件中删除以下行 <identity impersonate="true" userName="blah" password="blah">

我花了一些时间才最终遇到以下线程: 无法加载文件或程序集或其依赖项之一。访问被拒绝。问题是随机的,但发生一次后,它会继续

于 2014-10-20T20:23:01.600 回答
2

我在卸载 VS2015 预览后尝试在 VS2013 中运行 ASP.NET 项目时遇到了这个错误。修复VS2013安装似乎已经解决了这个问题。

于 2015-07-10T21:52:03.753 回答
1

我得到这个答案对我来说是完美的

无需删除这些行

只需使用管理员权限关闭并重新打开 Visual Studio。

于 2019-10-30T05:47:03.197 回答
0

我从 gac 中删除了 dll 并开始工作。我不确定这些 dll 是从哪里来的。如果您有 2 个或更多版本的 Visual Studio,请重新安装最后一个版本。

于 2014-02-17T13:46:59.660 回答
0

我知道这是一个旧的,但我在使用 Visual Studio 2010 调试时遇到了这个错误(我也在同一台机器上运行 2013、2017 和 2019 ......我有一些旧版应用程序:oP)。在我的情况下,我使用本地 IIS 作为网络服务器(不是 express)进行调试,最后我不得不回收网站应用程序池,这可以清除错误(在重新启动 2010 之后)。戴夫

于 2021-08-31T03:37:28.123 回答
0

我今天打开了一个有 10 年历史的项目,在 VS 2019 (16.9.1) 中遇到了这个问题,在我的情况下是

<trust level="Medium"/>

从 web.config 或设置中删除上面的行<trust level="Full"/>解决了这个问题。

于 2021-03-14T18:14:38.817 回答
0

如果您在两个路径中都没有看到 web.config: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

文件“Web”在“ C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\”中,我真正想向您展示的是Web.config,您应该使用以下命令打开它:notepad++... 并删除:

//<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />"

我解决了他们的问题。

于 2017-12-22T13:06:59.663 回答
0

尝试更新您的 Microsoft.ApplicationInsights nuget 包。这也会安装其他依赖项。当我不得不更改我的目标框架时,我遇到了这个问题。

  1. 工具 > NuGet 包管理器 > 管理解决方案的 NuGet 包...
  2. 搜索“应用洞察”

或运行

Install-Package Microsoft.ApplicationInsights
于 2016-08-14T02:42:30.443 回答
0

我们的项目在很长一段时间内(错误地)引用了 GAC 中的 PageInspector.Loader.dll:

 <ItemGroup>
    <Reference Include="Microsoft.VisualStudio.Web.PageInspector.Loader">
      <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll</HintPath>
    </Reference>
  </ItemGroup>

它工作了一段时间,但最近部署到 Azure 导致错误“找不到包 Microsoft.VisualStudio.Web.PageInspector.Loader 的编译库位置”。

我们从 .csproj 文件中找到并删除了引用,问题已解决。

于 2019-08-20T13:14:37.343 回答
0

有一个类似的问题(另一个程序集),对我来说,这是机器上 web.config 中缺少的一行。我认为让 Web 服务器加载(任何?)dll 的一行。我必须在 web.config 中的编译组件列表中添加“*”:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

像这样

    <compilation>
      <assemblies>
        ...
        <add assembly="*" />
      </assemblies>
    </compilation>

为了找到它,我必须将文件与来自工作服务器的文件进行比较。所以在我看来,这确实是加载失败,但要确定它失败的原因,我们需要 Sherlook H.. 通常我使用 ProcessMonitor 之类的工具来找出为什么我得到加载失败,但这一次,当然,它没有给我任何有用的输出.. IIS 从未尝试加载程序集!

于 2017-11-29T19:09:32.320 回答
-4

通过在此线程中应用批准的解决方案,它最终解决了我的问题。

修改以下两个文件,并删除Microsoft.VisualStudio.Web.PageInspector.Loader解决了该问题。

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
于 2016-10-06T11:27:09.427 回答