请求的资源不支持http方法'OPTIONS'

时间:2017-08-30 09:05:07

标签: asp.net-web-api server

当我使用PUT或DELETE方法时,它会显示错误。 我想我在web.config中有正确的配置:

<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
    <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
  </customHeaders>
</httpProtocol>

<handlers>
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

我错过了什么吗? fiddler捕获的服务器响应为405,

{"Message":"The requested resource does not support http method 'OPTIONS'."}

0 个答案:

没有答案