Skip to content

ASP.NET Core: No route matches the supplied values. #131

@alexander-frolov

Description

@alexander-frolov

It appears that the issue reported in #18 returned in Microsoft.AspNetCore.Mvc.Versioning v1.1.0-rc1.

When I use query string versioning and have code like this

[ApiVersion("1.0")]
[Route("[controller]")]
public class TestController : Controller
{
        [HttpPost]
        [Consumes("application/json")]
        [Produces("application/json")]
        public async Task<IActionResult> RegisterAsync([FromBody] [Required] AgentInfo agentInfo)
        {
            return CreatedAtAction(
                "GetAgentInfoAsync",
                new
                {
                    agentSerialNumber = agentInfo.SerialNumber,
                    apiVersion = HttpContext.GetRequestedApiVersion().ToString()
                },
                await _agentRepository.CreateAsync(agentInfo.SerialNumber, agentInfo));
        }
}

When I request the RegisterAsync the first time, it fails with a "No route matches the supplied values" error. All subsequent requests are successful.

I tried with v1.1.0-beta2 and there is no such a problem.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions