.NET MVC - 系统找不到指定的路径
昨天我将网站从 c:\development\project\ 部署到 c:\inetpub\wwwroot\virtualdir\ (同一台电脑)。 它工作了一段时间,我可以通过访问 http://computername/virtualdir/ 访问该网站。
但是今天早上大家都遇到了错误:系统找不到指定的路径。
找不到指定的路径是什么? /virtualdir/bin/ 包含 System.Web.Mvc.Dll 程序集...而且部署项目已将其标记为依赖项,因此我在安装过程中确实被包含在内,它怎么会突然改变?
堆栈跟踪:
[DirectoryNotFoundException:系统找不到指定的路径。 (HRESULT 异常:0x80070003)]
[FileNotFoundException:无法加载文件或程序集“System.Web.Mvc,Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。 系统找不到指定的路径。]
[FileNotFoundException:无法加载文件或程序集“System.Web.Mvc,Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。 该系统找不到指定的路径。] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 布尔值 throwOnFileNotFound, 布尔值 forIntrospection) +0 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 布尔值 throwOnFileNotFound, 布尔值 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(字符串程序集名称,布尔星指令)+46
[ConfigurationErrorsException:无法加载文件或程序集“System.Web.Mvc,Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。 该系统找不到指定的路径。] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串程序集名称,布尔星指令)+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(字符串controllerName,HashSet`1命名空间)+83 System.Web.Mvc.DefaultControllerFactory.GetControllerType(字符串控制器名称)+305 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext,字符串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 步骤,Boolean&completedSynchronously) +75
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它找到了一个 System.Web.Mvc 就好了,正如您在堆栈跟踪中看到的那样:
看起来发生的是 ControllerTypeCache,在尝试枚举引用以查找控制器的所有程序集时,无法找到程序集这是另一个人引用的。
请阅读此博客文章,了解如何确定具体内容不见了。
It's finding a System.Web.Mvc just fine, as you can see in the stacktrace:
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.
对于通过搜索遇到此问题的其他人来说,另一个可能导致该错误消息的配置错误是,如果您没有在虚拟目录的配置中为“asnet_isapi.dll”创建通配符映射。
要创建映射:
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: