【发布时间】:2009-08-28 08:38:04
【问题描述】:
我还是 ASP.NET MVC 的新手,我在路由方面有点挣扎。
使用 ASP.NET 开发服务器(直接从 Visual Studio 运行),我的应用程序可以毫无问题地找到它的视图。使用标准的 ASP.NET URL - http://localhost:1871/InterestingLink/Register
但是,当我将网站发布到 IIS 并通过 http://localhost/MyFancyApplication/InterestingLink/Register 访问它时,我收到 404 错误。
对可能出现的问题有什么建议吗?
更多信息...
这是我的 global.asax 文件的样子(标准):
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
我的控制器也很简单:
public class InterestingLinkController : Controller
{
public ActionResult Register()
{
return View("Register");
}
}
【问题讨论】:
标签: asp.net-mvc routing