ASP.NET MVC路由返回404而不执行任何操作

bq1*_*990 5 asp.net asp.net-mvc asp.net-mvc-routing

我正在使用MVC2 Preview 1开发一个非常简单的应用程序.

我有一个名为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
        );
Run Code Online (Sandbox Code Playgroud)

这是我的控制器:

public class ContentController : Controller
{
    IRepository _repo = new SimpleRepository("db", SimpleRepositoryOptions.RunMigrations);

    public ActionResult Index()
    {
        var content = _repo.GetPaged<Content>(0, 20);
        return View(content);
    }
Run Code Online (Sandbox Code Playgroud)

Ber*_*hen 7

这是一个黑暗的镜头,但你有一个名为/ Content /的目录吗?

  • 答对了!结果是MVC模板创建了一个名为Content的目录,它放置了Site.css文件.现在我觉得自己像个白痴:(非常感谢大家的帮助! (2认同)