【发布时间】:2010-12-22 21:26:37
【问题描述】:
我在 IIS6 上运行 asp.net MVC 站点 - 我已将路由编辑为如下所示:
routes.MapRoute(
"Default",
"{controller}.aspx/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);
所以我所有的网址现在都包含 .aspx(根据 Phil Haack 的解决方案之一)。现在,我使用 Elmah 捕获所有未处理的异常,并且对于几乎每个页面请求,我都会收到 Elmah 捕获的以下错误,这是我在前端从未看到的(一切正常):
System.Web.HttpException: The file '/VirtualDirectoryName/Home.aspx' does not exist.
System.Web.HttpException: The file '/VirtualDirectoryName/Home.aspx' does not exist.
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
有一个 Home 控制器,应该可以找到它,但我不确定 a) 从哪里调用它,以及 b) 为什么我在前端看不到这个错误。有什么想法吗?
【问题讨论】:
标签: asp.net-mvc iis-6 routing