Jquery访问Webservice Chrome异常

来源:互联网 发布:网络ip摄像头偷窥软件 编辑:程序博客网 时间:2024/06/03 07:09
Jquery访问Webservice Chrome浏览器报
( XMLHttpRequest cannot load "XXX". No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin "XXX" is therefore not allowed access. )
异常解决方案,Webservice增加system.webserver配置节
web.config 配置如下:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>