让IIS静态网站支持跨域请求
2017-02-09 17:03
441 查看
在静态网站的web.config中配置customHeaders节点,详情如下
<?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Allow-Headers" value="Content-Type" /> <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> </customHeaders> </httpProtocol> <staticContent> <remove fileExtension=".json" /> <mimeMap fileExtension=".json" mimeType="application/json" /> <remove fileExtension=".mp3" /> <mimeMap fileExtension=".mp3" mimeType="audio/x-mpeg" /> <remove fileExtension=".appcache" /> <mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" /> </staticContent> <directoryBrowse enabled="true" /> </system.webServer> <location path="site.appcache"> <system.webServer> <caching> <profiles> <add extension=".appcache" policy="DontCache" kernelCachePolicy="DontCache" /> </profiles> </caching> </system.webServer> </location> </configuration>
相关文章推荐
- IIS配置asp.net网站出现错误:请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
- iis部署网站(asp.net或者wcf)出现HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
- IIS配置asp.net网站出现错误:请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
- IIS 静态网站跨域(CORS)
- IIS配置支持跨域请求
- IIS配置支持跨域请求
- 网站域名设置IIS支持flv的视频格式
- IIS默认网站无法启动,提示服务器无法及时响应服务或控制请求
- Vista系统下IIS安装 用以创建支持vs2008开发的网站
- win2003 iis 不支持请求(iis iso)的解决方法分析
- 让Windows Server 2008+IIS 7+ASP.NET支持10万个同时请求
- 让Windows Server 2008+IIS 7+ASP.NET支持10万个同时请求
- IIS网站已经停止,提示服务器没有及时响应启动或控制请求!本地计算机法启动 World Wide Web Publishing 服务。提示 “错误127: 找不到指定的程序”或者“错误1721,资源不足,无法启动
- 让IIS支持DZ和PW的伪静态方法
- IIS发布网站部分特殊配置--图片上传至别的服务器、iis配置 通配符应用程序映、iis配置 C#底层拦截.htm文件请求
- Windows Server 2008 IIS 7 ASP.NET 支持10万个同时请求
- 让Windows Server 2008+IIS 7+ASP.NET支持10万个同时请求
- Vista系统下IIS安装 用以创建支持vs2008开发的网站
- XP下的IIS不支持“新建网站”的功能,XP下的IIS只能使用新建“虚拟目录”
- (引用)让Windows Server 2008+IIS 7+ASP.NET支持10万个同时请求