title: C# Webapi POST request fails - 404 NOT FOUND
body: <p>I have a webapi Controller class with different action, GET and PUT are working fine, POST is failing the whole time and I am quite frustrated. Maybe you can give me some hints how I can solve this issue. </p>
  
  <p>Controller Action:</p>
  
  <pre><code>[RoutePrefix("api/v1/jobs")]
  public class JobsController : ApiController
  {
      [ActionName("PostInactiveStatus")]
      [System.Web.Http.AcceptVerbs("POST")]
      [System.Web.Http.HttpPost]
      public IHttpActionResult PostInactiveStatus(Job job)
      {
          CsJobSchedulerEntities dataContext = new CsJobSchedulerEntities();
          try
          {
              var refJob = (from j in dataContext.Job
                            where j.JOB_ID == job.JOB_ID
                            select j).SingleOrDefault();
  
              refJob.JOB_ACTIVE = 0;
              refJob.JOB_MUSER = job.JOB_MUSER;
              refJob.JOB_MDATE = DateTime.Now;             
  
              dataContext.SaveChanges();
  
              var jobs = dataContext.Job.ToList();
              return Ok(jobs);
          }
          catch (Exception ex)
          {
              return ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(ex.Message)));
  
          }
  
      }
  }
  </code></pre>
  
  <p>WebapiConfig class:</p>
  
  <pre><code>public static void Register(HttpConfiguration config)
  {
      config.MapHttpAttributeRoutes();
  
      config.Routes.MapHttpRoute(
          name: "DefaultApi",
          routeTemplate: "api/{controller}/{action}/{key}",
          defaults: new { key = RouteParameter.Optional }
      );
  
      //PAM: Add Default Message Handler when Content-Type is Empty
      config.MessageHandlers.Add(new DefaultContentTypeMessageHandler());  
  
      //PAM: Web API configuration and services
      EnableCrossSiteRequests(config);
  
  }
  
  private static void EnableCrossSiteRequests(HttpConfiguration config)
  {
      var cors = new EnableCorsAttribute(
          origins: "*",
          headers: "*",
          methods: "*");
      config.EnableCors(cors);
  }
  </code></pre>
  
  <p>Client Request:</p>
  
  <pre><code>function removeJob(data) {  
  
      jQuery.support.cors = true;
      $.ajax({
          url: HOST + "api/v1/jobs/PostInactiveStatus",
          type: "Post",
          data: data,
          async: false,
          beforeSend: function () {
  
          },
          success: function (data) {
  
          },
          error: function (xhr, ajaxOptions, thrownError) {
  
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p><img src="https://i.stack.imgur.com/msfl7.png" alt="Http Request Network request"></p>
  
  <p>Error Message:    </p>
  
  <blockquote>
    <p>"Message": "No HTTP resource was found that matches the request URI
    <code>http://localhost:59732/api/v1/jobs/PostInactiveStatus</code>.",
    "MessageDetail": "No type was found that matches the controller named
    'v1'."</p>
  </blockquote>
  
  <p>Where I fail?</p>
  
  <p><strong>UPDATE:</strong> The Controller has added the RoutePrefix for versioning the API, as stated GET and PUT are working fine.</p>