我正在使用MVC2 Preview 1的一個非常簡單的應用程序。ASP.NET MVC路由返回404不採取行動
我有一個名爲ContentController的控制器。我的問題是/ Content/Index工作正常,但/ Content /返回404。我在Studio Development Server上運行應用程序。
使用RouteDebugger進行測試,但/ Content /返回404,並且不顯示任何調試信息。
我並沒有改變路由代碼:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
這是我的控制器:
public class ContentController : Controller
{
IRepository _repo = new SimpleRepository("db", SimpleRepositoryOptions.RunMigrations);
public ActionResult Index()
{
var content = _repo.GetPaged<Content>(0, 20);
return View(content);
}
你在IIS或可視網絡服務器下運行這個嗎?如果IIS,哪個版本?你與/ Content(vs./Content /)有相同的結果嗎? –
嗯......這很奇怪。你能發佈路由調試器輸出的屏幕截圖= –
我在Visual Studio 2008提供的內置web服務器上運行它。 – bq1990