ASP.NET Web API - PUT & DELETE Verbs Not Allowed - IIS 8

前端 未结 19 1913
Happy的楠姐
Happy的楠姐 2020-11-22 05:16

I recently upgraded from Visual Studio 2010 to the Visual Studio 2012 RC. The installer also installs IIS 8 Express which Visual Studio now uses as the default web server.

19条回答
  •  长情又很酷
    2020-11-22 06:02

    The another reason can be the following:
    I changed my Url for Web Api method according to this answer:

    Url.Action("MyAction", "MyApiCtrl", new { httproute = "" })
    

    But this method creates link like:

    /api/MyApiCtrl?action=MyAction
    

    This works correctly with GET and POST requests but not with PUT or DELETE.
    So I just replaced it with:

    /api/MyApiCtrl
    

    and it fixed the problem.

提交回复
热议问题