1

我正在尝试创建一个临时网站,基本上将其锁定以显示单个控制器操作。

我试过了,但没有用:

routes.MapRoute(
  name: "Test",
  url: "Test/Index"
);

这就是我的 RouteConfig.RegisterRoutes 方法中的所有内容,除了:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

当我加载页面时,我得到:

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
4

1 回答 1

1

我想你正在寻找

routes.MapRoute(
  name: "Default",
  url: "{*url}",
  defaults: new { controller = "Test", action = "Index"});

使用 Index 方法强制对 TestController 的所有请求。

于 2013-09-11T19:21:32.097 回答