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:
- Searched my entire solution for references to AjaxControls. None found.
- Deleted all files in the deployment directory.
- Deleted all temporary ASP.NET files located in the Windows\Microsoft.net directory.
- Used ILSpy and other tools to find out if this assembly is somehow referenced in another way. It is not.
- 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