我新建mvc项目的结构图
现在我想运行区域1中的页面怎么配置Gloal.asax文件,或者是其他配置。
现在默认运行时不行的 找不到页面

解决方案 »

  1.   

    routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Home", action = "Index", id = 0 } // Parameter defaults
                );global里面  controller = "Home"改成 controller = "test1" 
      

  2.   

     public override void RegisterArea(AreaRegistrationContext context)
            {
                context.MapRoute(
                    "Area1_default",
                    "Area1/{controller}/{action}/{id}",
                    new { action = "Index", id = UrlParameter.Optional }
                );
            }
    自动生成的域 配置
    运行这个域里的 Index页面 无法找到资源
      

  3.   

    检查 url 是否 正确。
    默认的、域都再加上 命名空间 试试。
     routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
                    new string[] { "Web.Controllers" }             );
    public override void RegisterArea(AreaRegistrationContext context)
      {
      context.MapRoute(
      "Area1_default",
      "Area1/{controller}/{action}/{id}",
      new { action = "Index", id = UrlParameter.Optional },
    new string[] { "Web.Areas.Area1.Controllers" } 
      );
      }