2009-06-10 103 views
0

昨天我將我的網站從c:\ development \ project \部署到c:\ inetpub \ wwwroot \ virtualdir \(同一個pc)。它工作了一段時間,我可以通過http://computername/virtualdir/訪問該網站。.NET MVC - 系統無法找到指定的路徑

但今天早上,每個人都有一個錯誤:系統找不到指定的路徑。

無法找到指定的路徑是什麼?/virtualdir/bin /包含System.Web.Mvc.Dll程序集...另外,部署項目已將其標記爲依賴項,因此我在安裝過程中確實包含了它,它如何突然更改?

堆棧跟蹤:

[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

回答

1

它找到一個System.Web.Mvc就好了,因爲你可以在堆棧跟蹤看到:

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

什麼似乎正在發生的事情是ControllerTypeCache,當試圖列舉所有引用以查找控制器的assmeblies時,無法找到被另一個引用的程序集。

閱讀blog entry關於如何確切地確定缺少的內容。

+0

感謝您的信息! – Ropstah 2009-06-10 08:46:57

0

對於通過搜索來到此問題的其他人,可能會導致該錯誤消息的另一個配置錯誤是,如果您的虛擬目錄配置中沒有爲「asnet_isapi.dll」創建的通配符映射。

要創建映射:

  • 打開虛擬目錄的屬性。
  • 在「虛擬目錄」選項卡,單擊「配置」按鈕
  • 點擊「插入」,並瀏覽到相應的.NET版本的「ASPNET_ISAPI.DLL」文件
  • 取消選中「驗證文件是否存在」複選框
相關問題