403 Access denied for DELETE Request .Net Web Api Rest Service on Azure

1.5k views Asked by At

I'm quite unsure of the reason for this. On localhost all request types work.

But when I publish to a Windows Azure Shared Site GET, POST & PUT requests work and DELETE requests Fail.

Right after creating the Data I cannot delete it, this happens over my local ISP and works from my cell phones internet.

I've tried

  1. ipconfig /flushdns
  2. Changing to Google and OpenDNS
  3. Adding a default document in web.config for Mvc - Views/Home/Index.cshtml
  4. Adding - runAllManagedModulesForAllRequests="true"

This is all I get back.

HTTP/1.1 403 Access Denied
Date: Mon, 08 Jun 2015 16:15:44 GMT
Connection: keep-alive
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Content-Length: 249
1

There are 1 answers

4
ahmelsayed On

You probably just need to enable the DELETE verb in your web.config.

(source: http://microsoftazurewebsitescheatsheet.info/#enable-http-verbs)

<configuration>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <add name="ExtensionlessUrl-Integrated-4.0"
           path="*."
           verb="GET,HEAD,POST,DEBUG,DELETE,PUT"
           type="System.Web.Handlers.TransferRequestHandler"
           preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
</configuration>