WCF Restful JQuery 跨域解决方法
<?xml version="1.0"?> <!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
--> <configuration>
<connectionStrings>
<add name="BIEntities" connectionString="metadata=res://*/BI.csdl|res://*/BI.ssdl|res://*/BI.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=BI;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<customErrors mode="RemoteOnly"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint crossDomainScriptAccessEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
<bindings>
<webHttpBinding>
<binding crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<services>
<service name="Service.BIService" behaviorConfiguration="ServiceBehavior">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint kind="webHttpEndpoint" contract="Service.IBIService" behaviorConfiguration="HelpBehavior" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="HelpBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
注意: help无法显示肯定是配置错误,上面的配置中一处是服务名称,一处是接口名称。
<script type="text/javascript">
$(function () {
$(function () {
$.ajax({
type: "get",
url: http://server:88/KendoUI/ServiceHost/BIService.svc/InvoiceDelinquencyDistributionData,
dataType: "jsonp",
success: function (data) {
alert("ok");
}
});
});
});
</script>
WCF Restful JQuery 跨域解决方法的更多相关文章
- [转]vue跨域解决方法
vue跨域解决方法 vue项目中,前端与后台进行数据请求或者提交的时候,如果后台没有设置跨域,前端本地调试代码的时候就会报“No 'Access-Control-Allow-Origin' hea ...
- JavaScript跨域解决方法大全
跨域的定义:JavaScript出于安全性考虑,同源策略机制对跨域访问做了限制.域仅仅是通过“URL的首部”字符串进行识别,“URL的首部”指window.location.protocol +win ...
- WCF跨域解决方法及一些零碎的东西。
之前发过一篇随笔,说的WCF配置文件配置问题.里面也配了跨域支持,但是jsoncollback只支持Get请求,Post请求是解决不了,所以这里把真正的WCF跨域问题贴出来. 话不多说,直接帖配置文件 ...
- jquery、javascript实现(get、post两种方式)跨域解决方法
一.实现get方式跨域请求数据 浏览器端 <script> $(document).ready(function(){ $.ajax({ url: "http://www.xxx ...
- ajax 跨域解决方法
最近在开发过程中,使用ajax去异步调取图片.在开发中这个功能没什么问题,可以后来提测,重新部署之后就有问题了,这就是ajax的跨域问题. ajax核心对象XMLHttpRequest本身是不支持跨域 ...
- vue跨域解决方法 及设置api路径方法
vue项目中,前端与后台进行数据请求或者提交的时候,如果后台没有设置跨域,前端本地调试代码的时候就会报“No 'Access-Control-Allow-Origin' header is prese ...
- ajax原理和跨域解决方法
ajax是异步的 JavaScript 和 XML.通过在后台与服务器进行少量数据交换,AJAX 可以使网页实现异步更新.这意味着可以在不重新加载整个网页的情况下,对网页的某部分进行更新. 1--启动 ...
- 转载的别人的ajax跨域解决方法
http://dynamic.vip.xxxxxx.com/active/<controllers>/<active>/<id> 放在浏览器地址栏中访问可以得到正确 ...
- vue+axios跨域解决方法
通过这种方法也可以解决跨域的问题. 使用http-proxy-middleware 代理解决(项目使用vue-cli脚手架搭建) 例如请求的url:“http://f.apiplus.cn/bj11x ...
随机推荐
- 虚拟机安装Linux系统图文教程
虚拟机安装Linux系统图文教程 | 浏览:523 | 更新:2014-09-16 15:31 1 2 3 4 5 6 7 分步阅读 Linux系统的安装 工具/原料 VMware 9.0 虚拟机 L ...
- Ant、Maven、Gradle
android Gradle project http://www.ibm.com/developerworks/cn/opensource/os-cn-gradle/ http://www.voge ...
- PHP版本区别
- 【LeetCode OJ】Palindrome Partitioning II
Problem Link: http://oj.leetcode.com/problems/palindrome-partitioning-ii/ We solve this problem by u ...
- 破解 abexcrackme2
系统 : Windows xp 程序 : abexcrackme2 程序下载地址 :http://pan.baidu.com/s/1qXhyt8C 要求 : 注册机编写 使用工具 : OD 可在“PE ...
- HDU 4986
http://acm.hdu.edu.cn/showproblem.php?pid=4986 题意:n个钥匙放在n个箱子里,每个钥匙和箱子一一对应,求打开所有箱子的期望 题解: 题意: 求随机排列的期 ...
- JS获取年月日
<script language="javascript"> var myDate = new Date(); myDate.getYear(); //获取当前年份(2 ...
- Mercurial使用简单介绍【转】
Mercurial可以使异地开发进行统一的版本管理,比如一个项目有一部分人在银行内部开发无法用外网,另一部分人在公司开发,这两部分人需要一个统一的版本管理工具,mercurial这时候可以发挥作用 m ...
- Yocto 包管理 apt-get
/******************************************************************** * Yocto 包管理 apt-get * 说明: * 查一 ...
- ButterKnife View 注入
/***************************************************************************************** * ButterK ...