2

I have a WCF service that I access fram Javascript using AJAX and JSON. The client and the service is on the same site (domanin). It works great.

I now need to call the same service from several other sites/domains. How is this done? So far I have not found any resources describing this scenario.

These sites uses ASP.NET 4.0 (C#).

Jon
  • 37
  • 1
  • 5

2 Answers2

2

I agree that you need JSONP but I don't agree with using custom behavior from WCF 3.5 samples. WCF 4 has a native support for JSONP by turning on crossDomainScriptAccessEnabled in the webHttpBinding configuration. I wrote an example in this question.

Community
  • 1
  • 1
Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • Thanks, Ladislav. The `crossDomainScriptAccessEnabled` led me to this great article, http://bendewey.wordpress.com/2009/11/24/using-jsonp-with-wcf-and-jquery/. – Jon Apr 22 '11 at 17:53
0

you need use jsonp.

rerun
  • 25,014
  • 6
  • 48
  • 78