Asp.net mvc 4 无法使用区域作为单独的项目找到资源
我想将区域用作单独的项目。每当我尝试导航到此链接时: 我得到以下错误: 我的解决方案包含两个项目:实体\框架和模块 我的解决方案如下所示: 模块是我想用作区域的项目。我的主要项目: 实体_框架中的My Route.config看起来:Asp.net mvc 4 无法使用区域作为单独的项目找到资源,asp.net-mvc-4,asp.net-mvc-routing,asp.net-mvc-areas,Asp.net Mvc 4,Asp.net Mvc Routing,Asp.net Mvc Areas,我想将区域用作单独的项目。每当我尝试导航到此链接时: 我得到以下错误: 我的解决方案包含两个项目:实体\框架和模块 我的解决方案如下所示: 模块是我想用作区域的项目。我的主要项目: 实体_框架中的My Route.config看起来: public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{r
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "User", action = "Index", id = UrlParameter.Optional },
namespaces:new string[] {"entity_framework.Controllers"}
);
}
}
My moduleAreaRegistration.cs:
namespace entity_framework
{
public class moduleAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "module";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"module_default",
"module/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new string[] {"entity_framework.Controllers"}
);
}
}
}
在项目和索引视图中,我也在主控制器中添加了索引操作,但我陷入了这个错误。提前感谢。我将名称空间更改为
new string[] { "module.Controllers" }
在模块注册.cs中
然后我在主项目中的web.config中添加了以下内容:
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
这对我来说很好。我将名称空间更改为
new string[] { "module.Controllers" }
在模块注册.cs中
然后我在主项目中的web.config中添加了以下内容:
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
这对我来说很好。是否正在调用区域注册码?里面有什么?主项目是否引用了区域项目?@DavidG先生我也编辑并显示了我的区域注册。你能看一下吗?@DavidG先生你能帮我解决这个问题吗?我被困在里面了。这是我通过并试图创建模块化项目的链接:***正在调用区域注册码吗?里面有什么?主项目是否引用了区域项目?@DavidG先生我也编辑并显示了我的区域注册。你能看一下吗?@DavidG先生你能帮我解决这个问题吗?我被困在里面了。这是我尝试创建模块化项目的链接:****