这个问题困扰了我一段时间:
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”,为什么会失败?
尝试解决它/使用异常中的信息找出更多信息
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 文章中关于程序集绑定(bind)日志查看器的信息也没有帮助:( http://msdn.microsoft.com/en-us/library/e74a18c4.aspx )
任何人都可以照亮这个可憎的东西吗?我猜这是一个新手错误,但我现在不知道去哪里看。会不会是IIS 6.0配置问题?我使用的是 Windows XP 专业版和 Visual Studio 2008。
启动 Assembly 绑定(bind)监视器后,它会喷出如下内容:
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 位模式加载,这将不起作用。
检查以下内容并将其删除:
<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\vsinstr.exe"/>
关于c# - 无法加载文件或程序集 'app_code' 或其依赖项之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1246853/