.NET MVC - 系统找不到指定的路径

时间:2009-06-10 08:20:31

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

昨天我将我的网站从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,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:无法加载文件或程序集'System.Web.Mvc,Version = 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名称空间)+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 个答案:

答案 0 :(得分:1)

它正好找到一个System.Web.Mvc,正如你在stacktrace中看到的那样:

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

它出现的是ControllerTypeCache,在尝试枚举为查找控制器而引用的所有assmeblies时,无法找到另一个引用的程序集。

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

答案 1 :(得分:0)

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

创建映射:

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