Mit der MVC-Web-API für das Posten von JSON-Daten erhalte ich den Wert 404

Ich habe eine Web-API in MVC4. Beim Posten von Daten mit Ajax erhalte ich eine 404, und ich verstehe nicht, warum.

LanguageController:

[AcceptVerbs("POST")]
public void Delete(string id)
{
    Guid guid = Guid.Parse(id);

    Language language = db.Languages.Find(guid);
    db.Languages.Remove(language);
    db.SaveChanges();

}

Routing:

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "DefaultActionApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

        var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
        config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
    }
}

Und Javascript (mit AngularJS):

this.delete = function (lang) {
    $http({
        method: "POST",
        url: "/api/language/delete",
        data: JSON.stringify({ id: lang.id })
    })
    .success(function (response) {
        return true;
    })
    .error(function (response) {
        return false;
    });
};

Ich erhalte folgende Fehlermeldung:

**{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:32166/api/language/delete'.","MessageDetail":"No action was found on the controller 'Language' that matches the request."}**

Ich verstehe nur nicht warum, es sieht so aus, als ob es funktionieren sollte. Ich habe das Gefühl, eine wichtige Information zu verpassen.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage