I have an WebAPI,
public class SystemHealtController : ApiController
{
[HttpGet]
public IHttpActionResult UpdateUsageDetail(string cpuUsage, string memoryUsage, string diskUsage)
{
// Do Stuff
return Ok();
}
RouteConfig also have default settings,
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Job", action = "Index", id = UrlParameter.Optional }
);
}
}
But when I navigate to API URL, http://localhost:64384/API/SystemHealt/UpdateUsageDetail?cpuUsage=2&memoryUsage=4&diskUsage=76
, get following error:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
The only thing I suspect is, before creating Controller, I Installed
Microsoft.AspNet.WebApi
and then uninstalled as well suspecting that could be the issue. But after uninstall also there were no errors.