I have an MVC4 project with many controllers. I added an API controller called BatchDetailsController in the root directory of the project.
I also created a WebApiConfig class as below:
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
I also invoke the above register method from global.asax as
WebApiConfig.Register(GlobalConfiguration.Configuration);
in Application_Start
Now I have tried to access the controller by using then URLs
/BatchDetails
/api/BatchDetails
/BatchDetails/Get
/api/BatchDetails/Get
All of them return 404
What is the URL I need to use in this case?
