I have an MVC4 project with language selection:
1 main part with:
This could be because the path was wrong. So check the path and the spelling of the controller first. In my case, my controller was named CampsController, and the WebApiConfig.cs file had an extra path in it.
Instead of: http://localhost:6600/Camps
It was: http://localhost:6600/api/Camps
I had not noticed the api word in the WebApiConfig.cs file:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Also it could be because the controller was incorrectly named. Here I called LayoutController, but should have called Layout instead:
@Html.Action("GetCurrentUser", "LayoutController" })
should be:
@Html.Action("GetCurrentUser", "Layout")
Another example, it could be because you have bad Route paths defined. Make sure your paths are correct. Example:
[RoutePrefix("api/camps")]
public class CampsController : ApiController
[Route("{moniker}")]
public async Task Get(string moniker)