Web API 跨域问题

解决办法:

1、web.config

<system.webServer>
<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>
<httpProtocol>
<customHeaders>
<!--<add name="Access-Control-Allow-Origin" value="http://xxx.com, http://yyy.com" />-->
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
</customHeaders>
</httpProtocol>
</system.webServer>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
指定网站
<add name="Access-Control-Allow-Origin" value="http://xxx.com, http://yyy.com" />

2、System.Web.Http.Cors

3、扩展

上一篇:Appium 解决锁屏截屏问题(java篇)


下一篇:golang pprof 内存分析