加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 07:14:48 所属栏目:asp.Net 来源:网络整理
导读:我正在使用MVC2 Preview 1开发一个非常简单的应用程序. 我有一个名为ContentController的控制器.我的问题是/ Content / Index工作正常,但/ Content /返回404.我在Studio Development Server上运行应用程序. 使用RouteDebugger测试但/ Content /返回404,并且
我正在使用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
        );

这是我的控制器:

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

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

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读