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 ...
随机推荐
- Qt中使用随机数
新建Empty qmake project,命名为UseRand UseRand.pro SOURCES += \ main.cpp QT += core main.cpp #include < ...
- AngularJS基本指令
<!doctype html> <html ng-app> <head> <meta charset="UTF-8"> & ...
- 重学STM32---(六)DAC+DMA+TIM
这两天复习了DAC,DMA再加上把基本定时器TIM6和TIM7看了一下,打算写一个综合点的程序,,,就在网上找了一些关于DAC,DMA和定时器相关的程序,最终打算写了输出正弦波的程序... 由于没有示 ...
- 服务器的Arch Linux,CentOS的,Debian的,Fedora的,Gentoo的,openSUSE的,Slackware的,和Ubuntu哪个好
我能够建议的就是:如果你自己是开发者,如果你自己买了一台 VPS 自己搭服务器用.选 Ubuntu/Debian 挺好.当然如果你觉得自己闲工夫实在多得没处花,可以隔三差五的就到服务器上做升级更新,用 ...
- 转:SQL SERVER数据库中实现快速的数据提取和数据分页
探讨如何在有着1000万条数据的MS SQL SERVER数据库中实现快速的数据提取和数据分页.以下代码说明了我们实例中数据库的“红头文件”一表的部分数据结构: CREATE TABLE [dbo]. ...
- 脚本语言&& Performance Testing
watin: http://www.cnblogs.com/dahuzizyd/archive/2007/04/13/ruby_on_rails_windows_instatnrails_study_ ...
- CSS 实现:文字水平垂直居中
☊ [实现要求]: <div class="demo1"> 标题1111 </div> √ [实现]: 方案一:普通布局 .demo1 { text-ali ...
- notebook
1. 2.
- ci(转)
1 从代码管理器签出源文件 2 修改代码 3 编译代码 4 遇到错误,转到2继续修改直到达到预期 5 运行单元测试,期望所有的测试绿色(通过) 6 单元测试出错,转入2 7 重构代码,按 ...
- JavaScript 阶段总结