"ReRoutes": [
{
"DownstreamPathTemplate": "/api/Agent/GetPagedAgents?page={page}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "agent.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/account/user/list/GetPagedAgents?page={page}",
"UpstreamHttpMethod": []
}]
Here I am trying to Re-route my UpstreamPathTemplate to DownstreamPathTemplate from a query string,
"http://accountmanagement/api/account/user/list/GetPagedAgents?page=1"
this is my query string am sending to my account management service for re-route to my agent service using ocelot.
This is my Controller method in agent service for receiving re-routed path
[HttpGet]
[Route("GetPagedAgents")]
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public IActionResult Get(string page, string pageSize, string filter,
string sortBy)
{
var Result = _agentServices.GetAll(Convert.ToInt32(page),
Convert.ToInt32(pageSize),filter,sortBy);
return Ok(Result);
}
But it's not working. In my OUTPUT window its showing message: Unable to find downstream route for path: /api/account/user/list/GetPagedAgents, verb: GET
that means here it's taking my UpstreamPath as
Upstream url path is /api/account/user/list/GetPagedAgents
missing the parameter here.
any help will be appreciated. Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…