我在我的网站中添加了一个名为博客的区域我创建了所有内容,我只是尝试通过手动输入 URL 在浏览器中访问它,但我收到了类似“'/' 应用程序中的服务器错误。”的错误。我附上了我的项目的代码和快照。任何帮助,将不胜感激。
全球阿萨克斯
public static void MyCustomRouting(RouteCollection coll)
{
coll.IgnoreRoute("{resource}.axd/{*pathInfo}");
coll.MapRoute("Default", "{controller}/{action}", new { controller = "Home", action = "Index" }, new[] { "Areas.Controllers" });
}
protected void Application_Start()
{
//RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
MyCustomRouting(RouteTable.Routes);
}
BloggingAreaRegistration.cs
using System.Web.Mvc;
namespace MVC_PageRouting.Areas.Blogging
{
public class BloggingAreaRegistration : AreaRegistration
{
public override string AreaName
{
get { return "Blogging"; }
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute("Blogging_default", "Blogging/{controller}/{action}/{id}", new {action="Index",UrlParameter.Optional });
}
}
}
文件夹结构:
错误: