我已经将一个ASP.NET MVC3站点部署到heathermcinerney.com。可以通过默认的家庭控制器访问基本链接。我创建了一个带有索引和创建视图的ClientsController。即使我在global.asax.cs文件中添加了routing.MapRoutes,也不会显示索引(见下文)。我可以添加' /创建'在'客户'在网址(没有显示我的索引)并看到我的表格。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace HeatherPAX
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Clients", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Clients", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
}