在.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. Xcode 8 的 Debug 新特性

    Contents OverView Static Analyzer Localizability Instance Cleanup Nullablility Runtime Issue View De ...

  2. Mysql:The table‘xxxx’is full

    下午跑程序,在插入mysql时突然报错: "The table'xxxx'is full" 而之前一直没问题的. 上网查了一下,都说临时表的问题,需要设置"tmp_tab ...

  3. C++ 中 ZeroMemory、memset 危险需慎用

    使用C/C++编程时,常使用ZeroMemory.memset或 “={0}”来对结构体对象进行初始化或清零.然而这三种方式都有各自的特点,使用时需谨慎,否则容易出现严重错误,本人今日解决一个导致宕机 ...

  4. 【源码】c#编写的安卓客户端与Windows服务器程序进行网络通信

    NetworkComms网络通信框架序言 用c#开发安卓程序 (xamarin.android)系列之三 源码(包含客户端与服务器端所有工程文件)    数据库文件 为了方便您测试,我临时搭建了一个服 ...

  5. iOS开发UI篇—ios应用数据存储方式(偏好设置)

    iOS开发UI篇—ios应用数据存储方式(偏好设置) 一.简单介绍 很多iOS应用都支持偏好设置,比如保存用户名.密码.字体大小等设置,iOS提供了一套标准的解决方案来为应用加入偏好设置功能 每个应用 ...

  6. env.sh

    #!/bin/sh#docker exec -i t nginx /usr/share/app/nginx/vip/webapp/evn.sh testtestUrl='http:\/\/192.16 ...

  7. [windows操作系统]windows管理

    1.磁盘管理: 1.1.使用DISKPART命令行工具创建扩展分区: windows自带有一个disk management(磁盘管理)工具,但在其中却找不到如何创建扩展分区(一般MBR分区格式需要扩 ...

  8. OC之160728

    NSData与NSMutableData:代表数据缓冲区有两个作用,将数据读入NSData和输出NSData数据 输出 将字符串写入指定文件 用NSFileManager:为创建,删除,移动,复制文件 ...

  9. 反射+泛型+缓存 ASP.NET的数据层通用类

    using System; using System.Collections.Generic; using System.Text; using System.Reflection ; using S ...

  10. javaEE(web)SEO优化 Yahoo军规

    javaEE(web)SEO优化 Yahoo军规 1.尽可能减少HTTP请求数2.使用CDN3.添加Expire/Cache-Control头4.启用Gzip压缩5.将CSS房在页面最上方6.将Scr ...