Windows Phone 8中的System.ServiceModel发生了什么

本文关键字:ServiceModel 发生了 什么 System 中的 Phone Windows | 更新日期: 2023-09-27 18:25:10

我正在为所有移动和桌面平台开发跨平台应用程序。这一切都在C#中。我使用XamarinVisual Studio中工作。这是一个客户端-服务器应用程序,所以我使用WCF。

受Miguel Castro:Extreme WCF的启发,我将解决方案分为WinForms客户端、ProxyContractsServicesConsole服务器主机。但是,像ProxyContracts这样的项目必须创建为PCL(可移植类库),这是我的问题-我不能在带有Windows 10或Windows Phone的PCL中使用System.ServiceModel。怎么回事?为什么?

什么是最好的散步?

编辑:我想Windows Universal 10没有问题,只有Windows Phone 8有问题。当我检查Windows 10时,它会自动检查回Windows 8。VS说:以下将自动成为目标,因为支持同一组可移植API:Windows8

第2版:更清楚地说,我很难在Portable Class Libiray中实现这个(下面),并选中Windows Phone 8

using System.ServiceModel;
namespace Contracts
{
    [ServiceContract]
    public interface IMyService
    {
        [OperationContract]
        int GetSomething();
    }
}

Windows Phone 8中的System.ServiceModel发生了什么

在这里查看通用Windows平台上支持哪些API的参考。

您可以使用WindowsPhone8中的WCF服务(如此处所述),但我找不到任何支持从WindowsPhone8.托管WCF服务的文档。