locked
Parser Error: System.IO.FileNotFoundException: Could not load file or assembly RRS feed

  • Question

  • User729951494 posted

    I have a Visual Studio 2013 solution with about ten projects in it from which I have removed one project, called AjaxControls. After deploying the solution using Visual Studio to IIS 7.5 (Windows 7 development machine), I get a "Parser Error" message in the browser saying that the server cannot load the assembly "AjaxControls". The full text of the Elmah error message is below (it is more helpful than the YSOD shown in the browser). I have no problem running the site when I am debugging it in Visual Studio.

    Troubleshooting steps taken:

    1. Searched my entire solution for references to AjaxControls. None found.
    2. Deleted all files in the deployment directory.
    3. Deleted all temporary ASP.NET files located in the Windows\Microsoft.net directory.
    4. Used ILSpy and other tools to find out if this assembly is somehow referenced in another way. It is not.
    5. Restarted VS, restarted computer.  I have the same problem on my deployment server.

    I can solve the problem by simply copying the AjaxControls.dll into my bin directory, but I would like to find a more permanent solution than this hack.

    Thanks for your help.

    Here is the Elmah stack trace:

    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)

    Note that I can turn on assembly binding, but all it does is tell me that it can't find the file. I don't want to find the file, I want to find what is referencing the file and change it, but all I get is "Calling assembly : (Unknown)."

    Note also that I have also posted this question on StackOverflow.com:  http://stackoverflow.com/questions/23254284/parser-error-system-io-filenotfoundexception-could-not-load-file-or-assembly

    Thursday, April 24, 2014 6:25 PM

Answers

  • User-933407369 posted

    hi JDGoldman,

    Had you use the Thrid-Part control or soft ?i assume that  you maybe need to update them.

    if you develop the project with AjaxControl , you need to add AjaxControlToolKit.dll and reference it in your project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 29, 2014 5:52 AM

All replies

  • User1208776063 posted

    Could not load file or assembly 'AjaxControls' or one of its dependencies.

      

    I'm not sure about the project structure on your end. Have you tried search for the text "AjaxControls" in the entire solution? If you are using some reference finding mechanism, that may not work quite well if there is any code using reflection to load assembly.  Assembly.Load("AjaxControls") could also cause similar exception.

    Thursday, April 24, 2014 7:58 PM
  • User729951494 posted

    Yes.  Sorry, I should have been more clear.  I did a text search throughout my entire solution for "AjaxControls".  The text doesn't appear in my solution. 

    Not sure if it matters, but my solution consists of a variety of class libraries and one ASP.NET Web Forms application. 

    I assume that there is something obvious I am missing, but I just simply can't figure it out. 

    Friday, April 25, 2014 3:08 PM
  • User-933407369 posted

    hi JDGoldman,

    Had you use the Thrid-Part control or soft ?i assume that  you maybe need to update them.

    if you develop the project with AjaxControl , you need to add AjaxControlToolKit.dll and reference it in your project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 29, 2014 5:52 AM