Search code examples
wcfsilverlight.net-4.0channelfactory

How can I implement ChannelFactory and WCF assembly sharing with Silverlight?


The preferred WCF implementation is with assembly sharing and ChannelFactory - a single instance of the contract means any service changes only need be made in one place, there's no proxy to update or maintain, etc.

I'd like to implement ChannelFactory with Silverlight. I've had enough of RIA Domain Services etc.

My Silverlight application can only reference Silverlight assemblies - fair enough. So I put the ServiceContract interfaces in a Silverlight assembly and reference that from my server and client.

The problem is that when I go to run my server (which is IIS hosted, in this case) I get

Could not load file or assembly 'System.ServiceModel, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

The Silverlight assembly containing the ServiceContract is built with a different version of System.ServiceModel than my server is using (which is .NET 4.0). How can I make this work?


Solution

  • Simply,

    using Portable Class Libraries;