无法加载文件或程序集“app_code”或其依赖项之一

这一直困扰我一段时间了:

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

我正在使用visual studio 2008和IIS6,由于某种原因,我得到了这个奇怪的错误。

为什么要加载’app_code’,为什么会失败?

试图解决它/使用exception中的信息找出更多

 WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

但这没有帮助,msdn文章中关于程序集绑定日志查看器的信息也没有帮助:( http://msdn.microsoft.com/en-us/library/e74a18c4.aspx )

任何人都可以为这种可憎的事物发光吗? 我猜这是一个新手的错误,但我不知道现在在哪里看。 可能是IIS 6.0配置问题? 我使用的是Windows XP Professional Edition和Visual Studio 2008。


在获得Assembly绑定监视器之后,它会发出如下内容:

 LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Projects\NNNNNN\src\Trunc\Web\web.config LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: Microsoft.VisualStudio.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d94fb3b9/d76068ec/Microsoft.VisualStudio.Web.DLL. LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d94fb3b9/d76068ec/Microsoft.VisualStudio.Web/Microsoft.VisualStudio.Web.DLL. LOG: Attempting download of new URL file:///C:/Projects/NNNNNN/src/Trunc/Web/bin/Microsoft.VisualStudio.Web.DLL. LOG: Attempting download of new URL file:///C:/Projects/NNNNNN/src/Trunc/Web/bin/Microsoft.VisualStudio.Web/Microsoft.VisualStudio.Web.DLL. LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d94fb3b9/d76068ec/Microsoft.VisualStudio.Web.EXE. LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d94fb3b9/d76068ec/Microsoft.VisualStudio.Web/Microsoft.VisualStudio.Web.EXE. LOG: Attempting download of new URL file:///C:/Projects/NNNNNN/src/Trunc/Web/bin/Microsoft.VisualStudio.Web.EXE. LOG: Attempting download of new URL file:///C:/Projects/NNNNNN/src/Trunc/Web/bin/Microsoft.VisualStudio.Web/Microsoft.VisualStudio.Web.EXE. LOG: All probing URLs attempted and failed. 

如果使用Visual Studio Performance Tools,则Visual Studio可能会在web.config appsettings部分中保留一个键。 它会导致加载32位库,如果您的应用程序以64位模式加载,则无法工作。

检查以下内容并将其删除:

  

这只是一个黑暗中的刺,但也许你的IIS上的ASP.Net安装有问题。 尝试打开Visual Studio命令提示符并运行

 aspnet_regiis -i 

这将把ASP.Net重新安装到IIS中。

此错误是由于web.config引用了类的错误包。 周末清理头脑,问题很容易解决。

当我第一次尝试使用“发布…”选项部署最近升级的应用程序(vs2008到vs2010)并且没有要求删除原始内容时,发生了此错误。

我尝试发布时遇到此错误。

尝试禁用您的防病毒软件。

这项工作对我来说!