HTTP Error 404 on WebAPI 2 Routes - Fix

ASP.NET Web API 2 Rocks.

I was using built in Attribute Routing and everything else worked fine But, I faced a crazy error 404 on my routes when I was declaring this route.

public class LookupsApiController : ApiControllerBase

        public HttpResponseMessage Get()
            return Request.Success(1);

I was going crazy over this error. I Installed "WebAPI 2 Help Page" [Install-Package Microsoft.AspNet.WebApi.HelpPage] and Tracing [Install-Package Microsoft.AspNet.WebApi.Tracing], the routes are registered and shows in the help page.

But it wasn't working.

And then found this answer in SO. (
It says that I was using conventional routes. "note that requests matching conventional routes can never reach attributed controller/actions."

My fix?
change the route prefix like this.


and access http://localhost:xxx/api/data/lookups/countries

It works!

Popular posts from this blog

Print a sales receipt using a thermal printer with C# for POS Application

Automatic redirect upon session timeout using ASP.NET MVC and Javascript

Could not create SSL/TLS secure channel - Fixed