【问题标题】:.NET MVC - The system cannot find the path specified.NET MVC - 系统找不到指定的路径
【发布时间】:2009-06-10 08:20:30
【问题描述】:

昨天我将我的网站从 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, 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,证据 assemblySecurity,StackCrawlMark 和 stackMark,Boolean for Introspection)+127 System.Reflection.Assembly.InternalLoad(String assemblyString, 证据 assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) +142 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException:无法加载文件或程序集“System.Web.Mvc,版本=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。该系统找不到指定的路径。] 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

【问题讨论】:

    标签: asp.net-mvc assembly-reference-path


    【解决方案1】:

    它可以很好地找到 System.Web.Mvc,正如您在堆栈跟踪中看到的那样:

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

    看起来正在发生的是 ControllerTypeCache,在尝试枚举所有被引用的程序集以查找控制器时,无法找到另一个程序引用的程序集。

    阅读此blog entry,了解如何准确确定缺少的内容。

    【讨论】:

      【解决方案2】:

      对于通过搜索提出此问题的其他任何人,如果您没有在虚拟目录的配置中为“asnet_isapi.dll”创建通配符映射,则可能导致该错误消息的另一个配置错误。

      创建映射:

      • 打开虚拟目录的属性。
      • 在“虚拟目录”选项卡上,单击“配置”按钮
      • 单击“插入”并浏览到相应 .Net 版本的“aspnet_isapi.dll”文件
      • 取消选中“验证文件是否存在”复选框

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-03-20
        • 1970-01-01
        • 2011-02-23
        • 2018-12-12
        • 2016-04-23
        • 2017-01-04
        • 2014-04-24
        相关资源
        最近更新 更多