ASP.NET Web API, C#, Web Application

No HTTP resource was found that matches the request URI

We were getting a very silly error on deploying a webapi based service.

It was a GETAction

[Route("api/OCS/unbarmsisdn/{msisdnparam}")]
public IHttpActionResult UnbarMsisdn(string msisdn)
{

....

}

We were getting the following Error message:

No HTTP resource was found that matches the request URI

 

The problem was simple but can be easily missed.

Let’s look at the method definition again:

[Route("api/OCS/unbarmsisdn/{msisdnparam}")]
public IHttpActionResult UnbarMsisdn(string msisdn)
{

....

}

 

If you noticed there’s a difference between the Method parameter and the Route Decorator parameter. Both parameters should have the same name and you should be able to browse the method using the browser.

 

 

Advertisements
Standard