403 Azure上的DELETE请求.Net Web Api Rest服务拒绝访问

时间:2015-06-08 16:20:50

标签: asp.net-web-api2 azure-web-sites

我很不确定这个的原因。 在localhost上,所有请求类型都有效。

但是当我发布到Windows Azure共享站点时 GET,POST& PUT请求工作和DELETE请求失败。

在创建数据后我无法删除它,这发生在我的本地ISP上,并通过我的手机上网进行。

我已经尝试了

  1. ipconfig / flushdns
  2. 更改为Google和OpenDNS
  3. 在web.config中为Mvc添加默认文档 - Views / Home / Index.cshtml
  4. 添加 - runAllManagedModulesForAllRequests =" true"
  5. 这就是我回来的全部。

    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 个答案:

答案 0 :(得分:3)

您可能只需要在web.config中启用DELETE谓词。

(来源: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>
相关问题