1. 在Startup中,加一句路由的Attribute就生效。
config.MapHttpAttributeRoutes();//添加路由路径
2.如图所示,使用实例
① StartUp.cs
② RFIDController.cs
③ 查看接口文档
3.参考资料:
https://forums.asp.net/t/2100905.aspx?attribute+routing+is+possible+with+self+host+