Reputation: 1598
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Web.Routing.RouteTable.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
}
My existing Application done by Asp.net Webforms and i implements webapi that application for my another application.now i call webapi i got 404 error after publish in server.And i also include
<modules runAllManagedModulesForAllRequests="true" />
in web.config file.please help me
Upvotes: 0
Views: 447
Reputation: 975
Your problem may be not related to the routing configuration, May be you are sending wrong web request. Can you give us your web request sample here !?
Anyway you just make sure this line of code exists in your application start :
GlobalConfiguration.Configure(WebApiConfig.Register);
Upvotes: 1