【发布时间】:2018-06-13 17:47:52
【问题描述】:
使用以下
app.UseMvc(routes =>
{
routes.MapRoute(
name: "beacon",
template: "beacon/{id?}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
http://www.example.com/beacon 符合我的预期并点击了BeaconController
但http://www.example.com/beacon/001 没有击中任何控制器并进入 404
我错过了什么?
【问题讨论】:
-
BeaconController 中是否有一个
Index操作方法,可以接受整数类型的输入id参数?
标签: c# asp.net-core asp.net-core-routing