C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource
解决方法:
打开Webservice的Web.config文件
<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> </system.webServer>
就可以解决跨域问题了