【发布时间】:2019-08-25 17:32:47
【问题描述】:
我正在使用 .net core api 开发一个 Angular 项目。在开发环境中。 api enpoint 与 postman 连接时返回 404
localhost:5000/api/OrderParts/ returns 404
控制器
namespace Inventory.API.Controllers
{
[ServiceFilter(typeof(LogUserActivity))]
[Route("api/[controller]")]
[ApiController]
public class OrderPartController : ControllerBase
{
private readonly IOrderPartRepository _repo;
public OrderPartController(IOrderPartRepository repo)
{
this._repo = repo;
}
[HttpGet]
public async Task<IActionResult> GetOrderParts([FromQuery]UserParams userParams)
{
var orderParts = await _repo.GetOrderParts(userParams);
Response.AddPagination(orderParts.CurrentPage, orderParts.PageSize,
orderParts.TotalCount, orderParts.TotalPages);
return Ok(orderParts);
}
}
}
【问题讨论】:
-
检查你的项目中是否启用了https,如果启用了,那么你在postman上的url需要有https:local host:5000/.......
标签: c# asp.net-core asp.net-web-api asp.net-core-routing