2015-10-15 11 views
6

Windowsユニバーサルアプリケーションでデュプレックス契約でwcfサービスを使用するにはどうすればよいですか? (; 10240のビルド10.0)、それはAPIをサポートしているmsdnよるWindowsユニバーサルアプリケーションでデュプレックスwcfサービスを使用する方法

のWindows 10を対象に、Windowsのユニバーサルアプリの中で二重WCFサービスを消費しようとしたとき

私はPlatformNotSupportedExcetpion: Operation is not supported on this platform.実行時例外を取得しています。

それが不可能な場合は、どのように私は私のシナリオに進むべき?私は同じマシン上で動作している2つのアプリケーション(コンソールとWindowsの普遍的なxamlアプリケーション)を持っており、私は双方向通信が必要です。

私はサービスホストを作成clasic .NET 4.6コンソールアプリケーション、持っている:私は両方、のChannelFactoryを試してみましたが、サービス参照の追加により、クライアントWCF生成している

[ServiceContract(CallbackContract = typeof(IMyServiceCallback))] 
public interface IMyService 
{ 
    [OperationContract(IsOneWay = true)] 
    void Initialize(); 
} 

public interface IMyServiceCallback 
{ 
    [OperationContract(IsOneWay = true)] 
    void OnFrame(int i); 
} 

var host = new ServiceHost(typeof(MyService), new Uri("net.tcp://localhost:8008/MyService")); 

var binding = new NetTcpBinding(); //I've also tried net http binding 
binding.Security.Mode = SecurityMode.None; 

host.Description.Behaviors.Add(new ServiceMetadataBehavior()); 
host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, 
         MetadataExchangeBindings.CreateMexTcpBinding(), 
         "mex"); 

host.AddServiceEndpoint(typeof(IMyService), binding, ""); 
host.Open(); 

サービス契約をダイアログ内にあり、in UWPアプリのNetHttpBindingNetTcpBindingです。

私は、WCFクライアントのインスタンスを作成しようと、それはPlatformNotSupportedExcetpionをスローします。

出典:System.Private.ServiceModel

のStackTrace:

at System.ServiceModel.ReflectionExtensions.GetInterfaceMap(Type type, Type interfaceType) 
    at System.ServiceModel.Description.TypeLoader.GetIOperationBehaviorAttributesFromType(OperationDescription opDesc, Type targetIface, Type implType) 
    at System.ServiceModel.Description.TypeLoader.<>c__DisplayClass8.<AddBehaviorsFromImplementationType>b__10(Type currentType, KeyedByTypeCollection`1 behaviors) 
    at System.ServiceModel.Description.TypeLoader.AddBehaviorsAtOneScope[IBehavior,TBehaviorCollection](Type type, TBehaviorCollection descriptionBehaviors, ServiceInheritanceCallback`2 callback) 
    at System.ServiceModel.Description.TypeLoader.AddBehaviorsFromImplementationType(ServiceEndpoint serviceEndpoint, Type implementationType) 
    at System.ServiceModel.ChannelFactory`1.ReflectOnCallbackInstance(ServiceEndpoint endpoint) 
    at System.ServiceModel.ChannelFactory`1.CreateDescription() 
    at System.ServiceModel.ChannelFactory.InitializeEndpoint(Binding binding, EndpointAddress address) 
    at System.ServiceModel.DuplexChannelFactory`1..ctor(Object callbackObject, Binding binding, EndpointAddress remoteAddress) 
    at System.ServiceModel.ClientBase`1..ctor(InstanceContext callbackInstance, Binding binding, EndpointAddress remoteAddress) 
    at System.ServiceModel.DuplexClientBase`1..ctor(InstanceContext callbackInstance, Binding binding, EndpointAddress remoteAddress) 
    at App1.ServiceReference1.MyServiceClientBase..ctor(InstanceContext callbackInstance) 
    at App1.ServiceReference1.MyServiceClient..ctor(MyServiceClientCallback callbackImpl) 
    at App1.ServiceReference1.MyServiceClient..ctor() 
    at App1.MainPage.<button_Click>d__1.MoveNext() 
+0

私は二重 'net.tcp' WCFサービスに完全に接続するために使用されていたUWPクライアントアプリケーションを持っています。私はWindows10に移行した後、最初からプロジェクトを再作成しましたが、今はまったく同じ 'PlatformNotSupportedException'を取得します。 – jsanalytics

+0

私はこの特定の解決策の中に23のプロジェクトを持っています。それらのすべてが 'AnyCPU'プラットフォームではなく、' x86'または 'x64'プラットフォームのみを受け入れる/許す、新しく作成されたUWPプロジェクトを除いて' AnyCPU'プラットフォームを使用しています。だから、私はそれが問題の原因だと思う。私は手動で 'AnyCPU'を追加してプロジェクトファイルを混乱させようとしましたが、それはうまくいかなかったのです。また、これはWindows 8.1では問題なく動作していました。 UWPプロジェクトテンプレートやそのような性質の問題があるかもしれません。 – jsanalytics

+0

別のスレッドの誰かがそれに気づいた。 CallbackContract属性を削除すると、UWPクライアントは接続を作成できるため、基本的なWCFが機能します。 その後、彼はUWP –

答えて

0

両面シナリオは10580ビルド(最新.NETCoreのV5.1.0)でさえもサポートされていません。

WCFの二重の実装における反射の間違った使用法についてGitHubのイオン報告バグがありました。この不具合は、.netコア用の最新ビルドで修正され、Nugetギャラリーのindividual packageを含めることができます。ただし、このパッケージでは、System.RuntimeおよびSystem.Threadingのプレリリースバージョンも含める必要があります。

enter image description here

は、.NETのコア1.0の一部が先月リリースされたとして、それは、WCFの

4

安定版をお役に立てば幸いです。 UWPプロジェクトのproject.jsonファイルのMicrosoft.NETCore.UniversalWindowsPlatformパッケージの5.2.2バージョンを参照することで、WindowsユニバーサルアプリケーションでDuplexや他の多くのバージョンのWCF featuresをサポートできるようになりました。

関連する問題