在.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. F2工作流引擎之 概述(一)

    简介 工作流应该算是基础框架软件,主要用于流程的重组和优化,它有广阔的应用领域.在java下有很多优秀的开源工作流可以选择比如activit5.jpbm4等,在.net下却几乎找不到令人满意的工作流引 ...

  2. PDF 补丁丁 0.4.2.950 测试版发布:按文件夹合并生成单独的PDF文件

    新的测试版实现了将文件夹的内容合并为单独的PDF文件的功能.以下图为例讲解操作步骤. 点击工具栏的“合并文件”按钮,打开合并功能. 设M盘下有“test”和“test2”文件夹,里面包含了需要合并的文 ...

  3. 微信公众平台如何获取用户的OpenID(一)

    如何获取用户的OpenID,对于微信开发模式下的开发来说,那就是一个非常简单的小功能了.简单介绍一下我是怎样去获取OpenID的. 微信服务器与公众账号服务器交互的信息可以分为3类:请求消息.事件和响 ...

  4. .htaccess的301重定向代码

    把不带www的域名301到带www的域名 RewriteEngine On RewriteCond %{http_host} ^example.com$ [NC] RewriteRule ^(.*)$ ...

  5. [转]Web3.0时代,企业知识管理新趋势

    [转自http://www.amt.com.cn/html/ManageFront/AMTPoint0/2014/0716/1370.html] Web3.0时代,企业知识管理新趋势 2014-07- ...

  6. DIV+CSS

    1.可以引入外部的样式:<link  rel="stylesheet"  type="text/css"  href="外部的CSS文件路径&q ...

  7. iOS 开发获取唯一标识

    在做流量精灵的时候有这样一个需求,帐户默认需要取手机的imsi 信息.这就有一个好处,即便用户删除我们的应用后从新下载,下次进入时他们还会以同样的身份登陆,并且获得原先纪录.这样不仅对于开发公司人员来 ...

  8. poj3159 差分约束 spfa

    //Accepted 2692 KB 1282 ms //差分约束 -->最短路 //TLE到死,加了输入挂,手写queue #include <cstdio> #include & ...

  9. 关于ubuntu下词典安装

    圣诞快乐!merry xmas! 身为程序猿和研究僧,英文文献是经常接触的,所以在ubuntu下当然需要一款英汉词典啦 查了下推荐stardict的比较多,于是学着安装了下,感觉还不错,但是只有词典功 ...

  10. 从零开始学习Node.js例子四 多页面实现数学运算 续一(使用connect和express框架)

    1.使用connect框架 .use方法用于绑定中间件到connect服务器,它会配置一系列在接到请求时调用的中间件模块,此例中我们要配置的中间件有favicon logger static rout ...