This is my configuration for the Web API in App_Start/WebApiConfig.cs:
public static void Register(H
I was receiving this issue with a combination of a [RoutePrefix] and a [Route] on an action.
[RoutePrefix("/api/my/application")]
on the action I had
[HttpPost, Route("{someVariable:int}"]
When I changed: [RoutePrefix("/api/my/application")]
to[RoutePrefix("api/my/application")]
everything was fine.
I've got the same error with two (or more) slashes.
[Route("marketdata//tickerinfo")]
It's easy to happen when you change the string.
The reason for the above error is that I am using an additional '/' in the route attribute for the action. The action defined in the above controller should be as follows:
[HttpGet]
[Route("marketdata/tickerinfo")]
public IHttpActionResult TickerInfo(string currencyPair)
{
I got the same error however it was caused by the ActionName
attribute in my case.
[ActionName("")]
public void Get(string code)
Although this broke the Help pages I was still able to reach the endpoint api/controller?code=123
. When I removed the ActionName
attribute the error disappeared.