views:

49

answers:

2

I'm looking for best practices on where to host associated Webservices/WCF Services for Silverlight applications.

One approach I see quite often is to host these services in the same web application project that is used to host the silverlight application. This seems convenient because it unions the two pieces together.

However, with DRY shouldn't these services be hosted externally so that possibly other applications could make use of them? Should they be in one assembly?

My main concern would be if I had multiple projects on the go, being completed by in house and external contractors. Synchronizing releases seems difficult in this scenario.

+2  A: 

I would recommend hosting the WCF service separately. You'd just need to enable cross domain access for your service to allow the silverlight application to access it.

This would also allow you to have two separate release cycles for both of them and it makes for better maintainability if you'll have two separate teams working simultaneously.

Ritik Khatwani
My concern is having 2 silverlight projects, but only 1 wcf project. I'm not sure how I would migrate and merge changes.
itchi
I didn't get you. Are you worried about source control between the different teams or what Adrian's mentioned below?
Ritik Khatwani
Yes, exactly. I guess the second the part of my question is, if WCF services are hosted separately should I have 1 project or many. I may have up to 10 projects being developed at a time so migrations might be difficult and some code that is not complete may get published if it's in 1 project.
itchi
A: 

Sounds like you want some kind of interface between them. If you use dependency injection you'd have a solid interface the SilverLight could work aganist and you'd be able to swap-out services providers as often as you like; it'd also go a long way to isolating change.

Adrian K
I agree. What my main concern is if I should have 1 WCF project or many for a single enterprise consisting of many Silverlight applications (potentially over 50).
itchi
Keep it all together if they're logically bound together. If they're logically classifiable, it makes sense to break it apart into many services.
Ritik Khatwani