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?
views:
1495answers:
6
A:
Perhaps look in to JSONP
http://www.west-wind.com/Weblog/posts/107136.aspx
http://en.wikipedia.org/wiki/JSON
http://remysharp.com/2007/10/08/what-is-jsonp/
Chris MacDonald
2008-09-30 14:56:24
+6
A:
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
2008-09-30 15:01:13
+1
A:
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
2008-09-30 15:18:32
A:
- 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.
codemeit
2008-10-28 09:29:15
A:
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
2008-12-06 08:47:37