我已在本地机器上的服务器(Windows Server 2003)上的iis 6上发布了asp.net mvc应用程序。在服务器上,我已将默认页面设置为default.aspx。但是当我尝试在服务器上浏览网站时,它给了我例外 “传入的请求与任何路由都不匹配” 我注意到的一件事是。第5行的堆栈跟踪如下所示。它有一个奇怪的事情,异常仍然指向我的本地机器路径
[HttpException (0x80004005): The incoming request does not match any route.]
System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext) +15589
System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext) +40
System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +7
**UserManagement._Default.Page_Load(Object sender, EventArgs e) in D:\Evoletpublishnew\UserManagement\UserManagement\Default.aspx.cs:18**
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
答案 0 :(得分:0)
所有未被忽略的请求都需要映射到您可能缺少的某些控制器和操作。通常,默认路由如下所示,并且是路由表中的最后一个条目:
routes.MapRoute("Default", "{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
您在本地计算机上看到的引用只是编译程序集的文件的位置。
答案 1 :(得分:0)
我解决了。我更改了global.asax寄存器路由,如下所示:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute( "Default", "{controller}.mvc/{action}/{id}",
new { action = "Index", id = "" }
);
routes.MapRoute( "Root", "",
new { controller = "Account", action = "Index", id = "" }
);