PUT and DELETE returns 404 for asp.net webapi in Windows 2008 Server IIS 7 and 7.5

后端 未结 4 636
情书的邮戳
情书的邮戳 2021-01-18 07:03

I run into 500 - Internal Server Error when PUT/DELETE with windows 2008 server IIS. The response I get is:



        
相关标签:
4条回答
  • 2021-01-18 07:30

    I had the same issue recently on my Win Server 2008 R2 / IIS 7.5 and it took me couple of hours just to found out it was caused by LiveStreamingHandler. LiveStreamingHandler module on the IIS causes the PUT and DELETE HTTP verb error.

    Uninstall the Media Services 4.1 with Add and Remove program and reboot the server fixes this issue. Hope this help someone.

    0 讨论(0)
  • 2021-01-18 07:37

    After agonizing over a very similar problem, I came upon this solution: http://www.iis.net/configreference/system.webserver/security/requestfiltering/verbs

    Using the Request Filtering settings, I was able to globally allow the PUT and DELETE verbs in IIS, which solved my problem. It ended my nightmare of 404.6 errors. (btw, I did not have webDAV installed and did add the verbs to the ExtensionlessUrlHandler)

    Hopefully this info can save someone some time.

    0 讨论(0)
  • 2021-01-18 07:38

    I make the Neil S` information more exact:

    1. Delete WebDAV from "Modules"
    2. Delete WebDAV from "Handler Mappings"
    3. I delete WebDAV from IIS components to make sure WebDAV not exists and restart Windows
    4. Go to "Handler Mappings" and find ExtensionlessUrlHandler (for 32 and 64 and Integrated), open it and go to "Request Restrictions" to second chapter "Verbs" and put some of the methods you need to the string. I have the next: GET,HEAD,POST,DEBUG,PUT I repeat the changes for three "ExtensionlessUrlHandler" states.
    5. I do not change Request Filtering settings

    So, 404 and 405 error for Put method was disappeared, I receive 200 status.

    This solution works for me.

    0 讨论(0)
  • 2021-01-18 07:39

    Try turning on custom error by adding

    <customErrors mode="Off" />
    

    You will see the actual cause of the 500 error when you browse to the API controller, e.g.: http://staging.site.com/api/book.

    You will find more clues from the actual exception messages.

    0 讨论(0)
提交回复
热议问题