首页 > 代码库 > GIS-005-Terrain跨域访问
GIS-005-Terrain跨域访问
方法一:
在数据服务目录中添加一个Web.config文件,文件内容是:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://www.mamicode.com/*" />
<add name="Access-Control-Allow-Methods" value="http://www.mamicode.com/GET,POST,PUT,DELETE,HEAD,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="http://www.mamicode.com/Content-Type,api_key,Authorization,X-Requested-With" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
方法二:
打开IIS,打开数据服务站点,切换到功能视图,点击HTTP响应标头,分别添加:
Access-Control-Allow-Methods : GET,POST,PUT,DELETE,HEAD,OPTIONS
Access-Control-Allow-Origin : *
Access-Control-Allow-Headers : Content-Type,api_key,Authorization,X-Requested-With
GIS-005-Terrain跨域访问