Brian Ball
Brian Ball

Reputation: 12596

Unable to create WCF channel in portable class library

I'm hoping I've just missed something obvious and someone will point it out to me here.

I've created a PCL that contains my WCF service as well as the DTOs that it uses. The idea is to reference this on the server and implement the service, and also reference it on the client and use something like ChannelFactory<T> to create the channels and make the WCF calls.

I can do this without a problem in a standard class library, but the PCL has a limited subset of the classes available, and most of the classes I've tried to use are abstract.

Can someone please help me? Thanks

Upvotes: 0

Views: 874

Answers (1)

Drew Marsh
Drew Marsh

Reputation: 33379

ChannelFactory<T> is not available in the PCL when you're targeting Windows 8 (WinRT) or Silverlight for that matter. Everything is assumed to be done with ClientBase<T>. This does suck as it creates a lot of ceremony around things, but if you use the "Service Reference" feature in Visual Studio (svcutil.exe on command line) it will generate the necessary plumbing for you.

Note that if you were able to drop Silverlight and also go with Windows 8.1 compatibility you will get ChannelFactory<T> back.

Upvotes: 4

Related Questions