webService 跨域请求webconfig配置

在webService文件夹下单独添加一个web.config

 

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>

<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/>
<add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<modules>
<add name="MyHttpModule" type="WebServiceDemo.MyHttpModule"/>
</modules>
</system.webServer>
<system.web>
<httpRuntime executionTimeout="30000"/>
<authorization>
<allow users="*"/>
</authorization>
<compilation debug="true" />
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
</system.web>

</configuration>

posted on 2016-02-29 17:18  吴翰哲  阅读(1122)  评论(0编辑  收藏  举报

导航