Web.Config中的位置
<configuration>
<system.webServer>
<httpProtocol>
<!--http协议内容-->
</httpProtocol>
</system.webServer>
</configuration>
1.设定网站服务器以指定预设兼容性模式 Lionden
<!-- 设定网站服务器以指定预设兼容性模式 Lionden -->
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>
2.关于跨域访问设置
<!-- 设定服务器支持JavaScript 所有源访问 -->
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</customHeaders>
</httpProtocol> <!-- 设定服务器支持JavaScript 允许'http://localhost:52411'源访问 -->
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://localhost:52411" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</customHeaders>
</httpProtocol>