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?

有帮助吗?

解决方案

Simply,

using Portable Class Libraries;

其他提示

This non compatibility with silverlight and .net, is partially artificial, and can be worked around, if you know how to do it.

http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top