3

We are designing a web application using ASP.NET and AJAX and we want to host our WCF Service Layer on a different website and make JavaScript calls to the Service Layer from our client pages. We understand that the browser will not allow AJAX calls to a different port or domain. What is the best way to architect a solution? We are considering using a proxy layer with services hosted on the same domain as the client which has a web reference to the service layer. Is there a better solution?

Jason Bunting
  • 58,249
  • 14
  • 102
  • 93

5 Answers5

6

It's generally best to limit the number of domains accessed by your page. A server-side proxy is really a good way to go.

keparo
  • 33,450
  • 13
  • 60
  • 66
1

i think the best way is to call a local Page which call remote resource and returns result. in this way, you avoid cross domains problems

stefano m
  • 4,094
  • 5
  • 28
  • 27
0
  • You can do virtual hosting of the service and website under same domain but different folder.
  • define the services in different dlls and create svc files in your websites and point the svc files to the dll which has the services
  • server side proxy.
Ray Lu
  • 26,208
  • 12
  • 60
  • 59
0

Your load balancer could send all request to /service to your service server.

If you don't have a load balancer, you can have your webserver act as a reverse proxy to your service server. If you are using IIS7, you can do this with the Application Request Routing module.

Lance Fisher
  • 25,684
  • 22
  • 96
  • 122
0

Prototype has a plug in for this. The issue is on the client not the server. www.mellowmorning.com/2007/10/25/introducing-a-cross-site-ajax-plugin-for-prototype/