title: Asp.Net MVC4 + Web API Controller Delete request >> 404 error
body: <p>I have a VS2012 MVC4 solution where I test Web API Controllers.</p>
  
  <p>I successfully tested the GET, POST, PUT but the DELETE still got me an http 404 error. When I set a breakpoint in my 'DeleteMovie' action in my api controller, the breakpoint is never reached.</p>
  
  <p>I read a lot of posts about this problem but no one helped me.</p>
  
  <p>Here is my API Controller for the DELETE:</p>
  
  <pre><code>    [HttpDelete]
      public HttpResponseMessage DeleteMovie(int id)
      {    
          // Delete the movie from the database     
          // Return status code    
          return new HttpResponseMessage(HttpStatusCode.NoContent);
  
      }
  </code></pre>
  
  <p>Here is my html page:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      deleteMovie(1, function ()
      {
          alert("Movie deleted!");
      });
  
      function deleteMovie(id, callback) {
          $.ajax({
              url: "/api/Movie",
              data: JSON.stringify({ id: id }),
              type: "DELETE",
              contentType: "application/json;charset=utf-8",
              statusCode: {
                  204: function () {
                      callback();
                  }
              }
          });
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>My classic route is as follow:</p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
          );
      }
  </code></pre>
  
  <p>My routing for API is as follow:</p>
  
  <pre><code>    public static void Register(HttpConfiguration config)
      {
          config.Routes.MapHttpRoute(
              name: "ActionApi", 
              routeTemplate: "api/{controller}/{action}/{id}", 
              defaults: new { id = RouteParameter.Optional }
          );
  
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
      }
  </code></pre>
  
  <p>In my solution properties, I configure the 'Use local IIS Web server' with 'Use IIS Express' checked</p>
  
  <p>I also tried with 'Use Visual Studio Development Server' but same problem.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks.</p>