I'm working on cross-platform application for all mobile and desktop platforms. It's all in C#. I'm working in Visual Studio
using Xamarin
. It's a client-server app, so I use WCF.
Inspired by Miguel Castro: Extreme WCF I divided my solution into WinForms
client, Proxy
, Contracts
, Services
and Console
server host. But projects like Proxy or Contracts must be created as PCL (Portable Class Library) and here is my problem - I can't use System.ServiceModel in PCL with Windows 10 or Windows Phone. What's going on? Why?
What's the best walkaround?
EDIT:
I guess there is no problem with Windows Universal 10
, only with Windows Phone 8
. When I check Windows 10, it automatically check back to Windows 8
. VS says: The following will be automatically targeted because the support the same set of portable APIs: Windows 8
EDIT2: To be even more clear, I'm struggling implementing this (below) in Portable Class Libiray with checked Windows Phone 8:
using System.ServiceModel;
namespace Contracts
{
[ServiceContract]
public interface IMyService
{
[OperationContract]
int GetSomething();
}
}
Take a look here for references on which APIs are supported on the Universal Windows Platform.
You can consume WCF services from Windows Phone 8 (as detailed here) but I am not able to find any documentation that supports hosting WCF services from Windows Phone 8.