MVC WebApi endpoints do not work on production, but regular endpoints do

I have an ASP.NET MVC project that runs perfectly locally. It has some controllers that inherit from Controller and some that inherit from ApiController. My routes are below. When I run the project through Visual Studio locally, it works perfectly. I can hit all endpoints and get expected responses. When I deploy it to a cloud server (Windows Server 2008 r2), only the :Controller endpoints work (those at /p/{controller}/{action}). None of the endpoints at any :ApiController work. I get the following error for all of them:

{"$id":"1","Message":"No HTTP resource was found that matches the request URI 'http://DOMAIN/CONTROLLER'.","MessageDetail":"No type was found that matches the controller named 'CONTROLLER'."}

My routes:

In RouteConfig.cs:

routes.MapRoute(
            name: "Default",
            url: "p/{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Redirect", id = UrlParameter.Optional }
        );

In WebApiConfig.cs:

    config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "{controller}",
        defaults: new { }
    );

Answers


I copied the code to a new webapi project and it works. It must have been some kind of configuration issue with the old project rather than a dependency missing on the VM, but I still don't know the real cause was.


There are some related questions to this previously and the answer was the same, create a new API project but the actual problem only had some possible causes, MVC 4 Web Api IIS7.5 HTTP 404 Page Not Found

Be great to get a diff of the projects.


Need Your Help

Is it correct to say if any non-macro variable that is used in a conditional directive evalutes to 0?

c macros preprocessor

Let's say I have the following piece of code. Is it correct to say that the conditional directive always evaluates to zero since M is expanded before compile time where the value of i is zero accor...