Description
This is very similar to #72, but is not the same or it might have been the core cause of #72.
If the route templates for HttpPut and HttpDelete only have a single parameter, there is a toxic relationship between the parameter names that will cause a version error to be thrown in certain situations.
The server reports:
Microsoft.AspNetCore.Mvc.Versioning.ApiVersionActionSelector: Information: Multiple candidate actions were found, but none matched the requested service API version '1.0'. Candidate actions:
The client reports:
"Error": {
"Code": "UnsupportedApiVersion",
"Message": "The HTTP resource that matches the request URI 'http://localhost:27162/api/v1.0/values/5' does not support the API version '1.0'."
}
Good
[HttpPut("{id}")]
[HttpDelete("{id}")]
[HttpPut("{boots}")]
[HttpDelete("{id}")]
Bad
[HttpPut("{middle}")]
[HttpDelete("{id}")]
[HttpPut("{boots}")]
[HttpDelete("{boo}")]
There seems to be some kind of super/sub string issue between the names. I did all my testing on the Put call but it turns out that a relationship between the parameter names exists that will prevent the Delete route from being matched also.
Here is an example project. I started with a new .NET Framework 4.6.1 ASP.NET Core Web Application (.NET Framework) project. I pruned out unnecessary methods and includes and updated all of the Microsoft.AspNetCore packages.
https://www.dropbox.com/s/vo80iolv08fms5l/RoutingSample.zip?dl=0
I have been using a combination of Postman and the PowerShell Invoke-RestMethod to call my app.
Here is my powershell script