在.htaccess文件里面添加下面代码:

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>

在 web.config文件设置:

<system.webServer>
... <httpProtocol>
<customHeaders>
<!-- Enable Cross Domain AJAX calls -->
<remove name="Access-Control-Allow-Origin" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>

黄聪:No 'Access-Control-Allow-Origin' header is present on the requested resource解决办法的更多相关文章

  1. C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource

    C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource 解决办法: 在c ...

  2. 【SpringBoot】No 'Access-Control-Allow-Origin' header is present on the requested resource.

    关键字:跨域,Access-Control-Allow-Origin,转码,解码 在做一个前后端分离项目,本来前端项目都可以正常访问后端接口,跨域是这么设置的,接口可以正常访问 @Configurat ...

  3. WCF REST开启Cors 解决 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 405.

    现象: 编写了REST接口: [ServiceContract] public interface IService1 { [OperationContract] [WebInvoke(UriTemp ...

  4. Failed to load http://wantTOgo.com/get_sts_token/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fromHere.com' is therefore not allowed access.

    Failed to load http://wantTOgo.com/get_sts_token/: No 'Access-Control-Allow-Origin' header is presen ...

  5. java、ajax 跨域请求解决方案('Access-Control-Allow-Origin' header is present on the requested resource. Origin '请求源' is therefore not allowed access.)

      1.情景展示 ajax调取java服务器请求报错 报错信息如下: 'Access-Control-Allow-Origin' header is present on the requested ...

  6. 跨域问题解决----NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost:11000' is therfore not allowed access'

    NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost ...

  7. has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    前端显示: has been blocked by CORS policy: Response to preflight request doesn't pass access control che ...

  8. .Net Core 处理跨域问题Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

    网页请求报错: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Or ...

  9. js跨域访问,No 'Access-Control-Allow-Origin' header is present on the requested resource

    js跨域访问提示错误:XMLHttpRequest cannot load http://...... No 'Access-Control-Allow-Origin' header is prese ...

随机推荐

  1. 探索C++的秘密之详解extern "C",这就是为什么很多.lib被我们正确调用确总是无法解析的。

    (转载,绝对的有用) lib被我们正确调用确总是无法解析.这是C++编译和C编译的区别 时常在cpp的代码之中看到这样的代码: #ifdef __cplusplus extern "C&qu ...

  2. Source Insight简介及下载破解

    对于长期混迹于.net平台的开发人员来说,研究C源码不是很常见,但是有时候我们不得不涉及c的研究,因为许多优秀的开源软件是用C/C++写就.查看C源码的利器除了VS外,还有另一个,那就是Source ...

  3. Eclipse新建web项目正常启动tomcat不报错,但不能访问项目的解决方法

    原因:  虽然我手动添加了自己下载的tomcat,但是由于在Eclipse中创建Server时,"Server Locations"选项采用的时默认配置,即"Use wo ...

  4. 模拟系列(一)——数字电路

    要求 简要模拟数字电路的运行过程,及电位(简化为L和H),用C# WinForm实现. 思路 逻辑部分 电路是一种图结构,基于C#的特性,设计Node类(结点)和Wire类(连线),且为泛型. 由于电 ...

  5. ios基础篇(十一)——UINavgationController的使用(二)页面切换

    上篇说到了添加UIBarButtonItem,接下来说说界面切换: 1.首先我们在刚才的RootViewController中添加一个按钮用来实现跳转: 打开RootViewController.m( ...

  6. get请求乱码

    1.get请求不管用什么编码都是乱码, 2.由于http请求最先到达的是容器,所以先要检查容器的unrencodeing <Connector port="80" proto ...

  7. Python 初级项目:远程操控电脑(三)-极客学院

    http://www.jikexueyuan.com/course/2376_1.html

  8. <我是一只IT小小鸟>读书笔记

    这篇文章给我感触最深的是开篇蒋宇东所出的一道选择题--今后的发展选择有三条:A.做一辈子IT民工:B.将大学时欠下来的债补上:C.改行. 他们用自己的成长故事告诉师弟师妹们:一定要弄清楚上大学首要的任 ...

  9. (转)javascript匿名函数的写法、传参和递归

    (原)http://www.veryhuo.com/a/view/37529.html (转)javascript匿名函数的写法.传参和递归 http://www.veryhuo.com 2011-0 ...

  10. c#中各类日期的计算方法,收藏

    DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d")));  //本周周一D ...