ApiGateway默认子域映射调用错误的方法

时间:2019-03-26 14:01:33

标签: c# amazon-web-services lambda gateway

我在api网关https://sub-domain.example.com/employee/中有一个自定义域条目,已映射到https://foo.execute-api.eu-west-1.amazonaws.com/Stage/ 会调用包含EmployeeController的Lambda函数,该函数必须与方法进行映射

[HttpGet("/")]
public async Task<IEnumerable<Employee>> GetEmployees()
{            
    ...
}

[HttpGet("{userId}")]
public async Task<User> Get(string userId)
{
    ...
}

调用 https://sub-domain.example.com/employee/ https://foo.execute-api.eu-west-1.amazonaws.com/Stage/ 时,应首先调用 GetEmployees()方法。 但是 https://sub-domain.example.com/employee/ 调用第二种方法。以下是Lambda日志

[信息] Microsoft.AspNetCore.Hosting.Internal.WebHost:请求开始GET https://sub-domain.example.com/employee/ [信息] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:路由与{action =“ Get”,controller =“ Employee”}匹配。执行动作EmployeeApi.Controllers。 EmployeeController.Get (EmployeeApi) [信息] AWSSDK:使用AWS开发工具包的默认凭证搜索找到凭证 [信息] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:执行带参数(员工)的操作方法EmployeeApi.Controllers.EmployeeController.Get(EmployeeApi)-验证状态:有效

[信息] Microsoft.AspNetCore.Hosting.Internal.WebHost:请求开始GET https://foo.execute-api.eu-west-1.amazonaws.com/Stage/ [信息] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:路由与{action =“ GetEmployees”,controller =“ Employee”}匹配。执行动作EmployeeApi.Controllers.EmployeeController.GetEmployees(EmployeeApi) [信息] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:执行操作方法EmployeeApi.Controllers。 EmployeeController.GetEmployees (EmployeeApi)-验证状态:有效

任何建议?

0 个答案:

没有答案