【问题标题】:iis 7.5 , make ajax request to the asp.net webApi,options method not allowed?iis 7.5,向asp.net webApi发出ajax请求,不允许使用options方法?
【发布时间】:2013-09-17 15:38:04
【问题描述】:

我向 asp.net webApi(GET Verb)发出 CORS ajax 请求。 发现borwser发送了一个额外的请求,这个article说这是'preflight request',但是为什么它会导致在Chrome控制台上显示一个错误:不允许方法(405)

网络配置:

  <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
<modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>

【问题讨论】:

    标签: c# ajax asp.net-web-api


    【解决方案1】:

    完全删除模块部分,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2014-03-02
      • 1970-01-01
      • 2020-03-19
      • 2018-02-28
      • 2019-05-15
      • 2014-12-20
      • 2016-05-06
      • 2014-09-27
      • 2016-04-27
      相关资源
      最近更新 更多