我正在试验http://www.restfulrouting.com/的文档。当我打开我的 routedug 时,链接就像我想要的那样。但是当我点击链接时,我得到一个 404。我有以下结构
1. Login
1.1 Company (Area)
1.1.1 Departments
1.1.2 Contacts
1.1.1 Company info
1.2 Customer (Area)
//other information
我的文件夹结构
Controllers (folder)
customers (folder)
AreasController.cs
CompanyController.cs
TestController.cs
AccountController.cs
路由.cs
using System.Web.Routing;
using RestfulRouting;
using extranet.Controllers;
using extranet.Controllers.customers;
[assembly: WebActivator.PreApplicationStartMethod(typeof(extranet.Routes), "Start")]
namespace extranet
{
public class Routes : RouteSet
{
public override void Map(IMapper map)
{
map.DebugRoute("routedebug");
map.Resource<CompanyController>(comp => comp.Only("show"));
/*******************************
********COMPANYAREA*************
********************************/
map.Area<AreasController>("customer", area =>
{
area.Resource<TestController>();
area.Resource<CompanyController>();
});
}
public static void Start()
{
var routes = RouteTable.Routes;
routes.MapRoutes<Routes>();
}
}
}
公司控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.Serialization;
using System.Web;
using System.Web.Mvc;
namespace extranet.Controllers
{
public class CompanyController : ApplicationController
{
//
// GET: /Company/
public ActionResult Index()
{
return View();
}
public ActionResult Show()
{
return View();
}
}
}
我的问题是当我去 {mysite}/customer/company --> 我得到 404 页面。当我到达 {mysite}/company 时,它会显示该页面。我在监督什么或我的错误在哪里?如果我在这里遗漏了一些代码,请告诉我,然后我会进行编辑。
提前致谢