【发布时间】:2018-08-20 21:31:08
【问题描述】:
我创建了一个将返回代理列表的 PublicController.cs。然后我构建并运行项目并打开 Postman 更改模式以获取并调用 http://localhost:50159/api/public/Agents 我得到的消息是
{
"Message": "No HTTP resource was found that matches the request URI 'http://localhost:50159/api/public/Agents'.",
"MessageDetail": "No action was found on the controller 'Public' that matches the request."
}
我有什么遗漏吗?
[HttpGet]
public IHttpActionResult Agents(string key, string diseaseId)
{
GuardKey(key);
var result = AgentsDataService.GetAgents();
return Json(result);
}
【问题讨论】:
-
尝试将路由添加到您的操作属性 - [HttpGet("agents")] - docs.microsoft.com/en-us/aspnet/core/mvc/controllers/…
标签: c# asp.net-web-api postman