分析器错误:System.IO.FileNotFoundException:无法加载文件或程序集

时间:2014-04-23 20:12:28

标签: asp.net visual-studio-2013

我有一个Visual Studio 2013解决方案,其中包含大约十个项目,我从中删除了一个名为AjaxControls的项目。在使用Visual Studio将解决方案部署到IIS 7.5(Windows 7开发计算机)后,我得到了一个" Parser Error"浏览器中的消息说服务器无法加载程序集" AjaxControls"。下面是Elmah错误消息的全文(它比浏览器中显示的YSOD更有帮助)。我在Visual Studio中调试时运行该站点没有问题。

采取的故障排除步骤:

  1. 搜索了我的整个解决方案,以获取对AjaxControls的引用。找不到。
  2. 删除了部署目录中的所有文件。
  3. 删除了位于Windows \ Microsoft.net目录中的所有临时ASP.NET文件。
  4. 使用ILSpy和其他工具来查明此程序集是否以某种方式以其他方式引用。事实并非如此。
  5. 我可以通过简单地将AjaxControls.dll复制到我的bin目录来解决问题,但我想找到比这个hack更永久的解决方案。

    感谢您的帮助。

    System.IO.FileNotFoundException: Could not load file or assembly 'AjaxControls' or one of its dependencies. The system cannot find the file specified.
    Generated: Wed, 23 Apr 2014 16:17:16 GMT
    
    System.Web.HttpParseException (0x80004005): Could not load file or assembly 'AjaxControls' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'AjaxControls' or one of its dependencies. The system cannot find the file specified.
    File name: 'AjaxControls'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail)
       at System.Web.UI.TemplateParser.AddAssemblyDependency(String assemblyName, Boolean addDependentAssemblies)
       at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistrationCore(TagNamespaceRegisterEntry nsRegisterEntry)
       at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistration(ArrayList nsRegisterEntries)
    
    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].
    
       at System.Web.UI.TemplateParser.ProcessException(Exception ex)
       at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
       at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
       at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
       at System.Web.UI.TemplateParser.Parse()
       at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
       at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
       at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
       at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
       at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
       at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
       at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
       at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    请注意,我可以启用程序集绑定,但它只是告诉我它无法找到该文件。我不想找到该文件,我想找到引用该文件的内容并进行更改,但我得到的只是"调用程序集:(未知)。"

1 个答案:

答案 0 :(得分:-1)

不确定您是否已完成此操作,只需关闭visual studio并重新启动即可。 如果解决方案有很多项目,我在2013年遇到过这种情况。