我无法在MVC中设置默认页面。我正在使用git hub的小写 - 虚线路由为url。当我打开我的项目时,我收到404错误。当我打开像localhost / home / index这样的页面时,它运行正常。
using LowercaseDashedRouting;
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("");
//routes.MapRoute(
// name: "Default",
// url: "{controller}/{action}/{id}",
// defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
// );
routes.Add(new LowercaseDashedRoute("{controller}/{action}/{id}",
new RouteValueDictionary(
new { controller = "home", action = "Index", id = UrlParameter.Optional }),
new DashedRouteHandler() ) ); }}}