从另一个域调用WCF服务 [英] Calling wcf service from another domain
本文介绍了从另一个域调用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jquery从另一个域中调用wcf服务,它在ie8中被完美调用,但是在Firefox和chrome中未调用同一服务,请帮助我
i am caling wcf service from another domain using jquery, its called perfectly in ie8 but the same service is not called in firefox and chrome, please help me
推荐答案
这就是所谓的跨域,是一种安全风险(即ie).
使用Jquery/JavaScript调用跨域WCF服务 [ ^ ]
使用JSONP使用带有jQuery的跨域WCF REST服务 [ ^ ]
祝你好运!
That''s called cross-domain and is a security risk (as is ie).
Calling Cross Domain WCF service using Jquery/JavaScript[^]
Consuming Cross-Domain WCF REST Services with jQuery using JSONP[^]
Good luck!
您正在使用jQuery,并且正在使用ajax调用来调用wcf服务.绑定必须是webHttpBinding.而且此绑定不允许您进行跨域调用.
因此,要解决此问题,
1.尝试在您的项目中拥有一个启用Ajax的WCF服务,并在同一项目中拥有多个跨域服务引用.
2.使用启用了Ajax的wcf服务来调用跨域服务.
3.最后,更改您的ajax调用(从.js文件或.aspx文件等.)以引用内部(在域内)启用了ajax的wcf服务.
您将在网上看到很多用于演示AjaxEnabledWcfService的示例.
Hi,
You are using jQuery and you are calling a wcf service using ajax calls. Binding needs to be webHttpBinding. And this binding does not allow you to have cross-domain calls.
So to fix that,
1. Try to have one Ajax Enabled WCF service in your project, and have multiple cross-domain service references in the same project.
2. Use your ajax enabled wcf service to make calls to the cross-domain service(s).
3. Finally change your ajax call (from .js file or .aspx file etc..) to refer to the in-house (within the domain) ajax enabled wcf service.
You will get lot of examples on the net for demonstrating AjaxEnabledWcfService.
这篇关于从另一个域调用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文