ASP.NET Web Api飞行前选项不一致

时间:2013-06-25 21:19:03

标签: asp.net-web-api http-options-method preflight

我从单页应用中收到了不一致的预检HTTP选项请求。 这有时只会随机发生 ,我改善问题的唯一方法就是按F5,事情好一段时间,直到我有点“闲置”一点点。

当它发生时,我的Chrome网络标签如下所示:

enter image description here

当我的

我的基础架构细分

  • AngularJS Application
  • ASP.NET Web Api
  • Visual Studio 2012
  • IIS 7.5
  • Windows 7

我已经阅读了一些文章,我的web.config的system.webServer看起来像这样:

<system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="false">
            <remove name="WebDAVModule" />
        </modules>
        <handlers>
      <remove name="WebDAV" />
      <remove name="OPTIONSVerbHandler"/>
            <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>
        <httpProtocol>
            <customHeaders>
        <add name="Access-Control-Max-Age" value="1728000"/>
            </customHeaders>
        </httpProtocol>
    </system.webServer>

0 个答案:

没有答案