.NET MVC - The system cannot find the path specified

5.9k views Asked by At

yesterday I deployed my website from c:\development\project\ to c:\inetpub\wwwroot\virtualdir\ (same pc). It worked for some time, I could reach the website by going to http://computername/virtualdir/.

But this morning everybody got an error: The system cannot find the path specified.

What is the path being specified that cannot be found? /virtualdir/bin/ contains the System.Web.Mvc.Dll assembly... Also the deployment project has marked it as a dependency so I was really included during the installation, how can it change suddenly?

Stack trace:

[DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)]

[FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the path specified.]

[FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the path specified.] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the path specified.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.BuildManager.GetReferencedAssemblies() +55 System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetReferencedAssemblies() +21 System.Web.Mvc.ControllerTypeCache.GetAllControllerTypes(IBuildManager buildManager) +62 System.Web.Mvc.ControllerTypeCache.EnsureInitialized(IBuildManager buildManager) +73 System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(String controllerName, HashSet`1 namespaces) +83 System.Web.Mvc.DefaultControllerFactory.GetControllerType(String controllerName) +305 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +65 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

2

There are 2 answers

0
Talljoe On BEST ANSWER

It's finding a System.Web.Mvc just fine, as you can see in the stacktrace:

System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128

What it appears is happening is the ControllerTypeCache, while attempting to enumerate all the assmeblies that are referenced in order to find controllers, is unable to find an assembly that's referenced by another.

Read this blog entry on how to determine exactly what is missing.

0
Peter Bernier On

For anyone else coming to this question via a search, another configuration error that can result in that error message is if you don't have a wildcard map created to 'asnet_isapi.dll' in your virtual directory's configuration.

To create the mapping:

  • Open your virtual directory's properties.
  • On the 'Virtual Directory' tab, click the 'Configuration' button
  • Click 'Insert' and browse to the appropriate .Net version's 'aspnet_isapi.dll' file
  • Uncheck the 'Verify File Exists' checkbox