C# 如何在不同的父文件夹中正确路由mvc控制器?

C# 如何在不同的父文件夹中正确路由mvc控制器?,c#,asp.net-mvc,asp.net-mvc-3,C#,Asp.net Mvc,Asp.net Mvc 3,我找不到解决这个问题的办法。 我必须在一个项目中加入两个MVC3项目。要做到这一点,我必须把它们放在不同的文件夹中。要了解我的意思,让我们看看这些图片: 第一个项目: 放入文件夹后: 现在,当我运行该项目时,出现以下错误: Server Error in '/' Application. The view 'Index' or its master was not found or no view engine supports the searched locations. The fo

我找不到解决这个问题的办法。
我必须在一个项目中加入两个MVC3项目。要做到这一点,我必须把它们放在不同的文件夹中。要了解我的意思,让我们看看这些图片:

第一个项目:

放入文件夹后:

现在,当我运行该项目时,出现以下错误:

Server Error in '/' Application.

The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml  
内部
Global.asax

namespace MvcApplication1
{
    // 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(
                "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);
        }
    }
}  
问题:

  • my global.asax的配置应该是什么?(因为我怀疑问题从这里开始)
  • 如果第一个问题可以解决,那么我将如何绘制第二个MVC3项目的路线图 非常感谢

    尝试使用Asp.net MVC-3中的“区域”


    通过这种方式,您可以最好地控制URL和输出。

    区域是MVC3中非常好的功能,您只需像这样对其进行路由即可

    "MVCApplication1/{controller}/{action}/{id}"
    
    "MVCApplication2/{controller}/{action}/{id}"
    

    在Global.asax中检查您是否已注册这些区域

    protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();