How can I use a duplex contract wcf service in a universal Windows application?
I get an exception when I execute PlatformNotSupportedExcetpion: Operation is not supported on this platform. when trying to use the wcf duplex service in the Windows Universal App, focusing on Windows 10 (10.0; Build 10240)
According to msdn , the API is supported.
If this is not possible, how should I continue in my scenario? I have two applications (console and window universal xaml application) running on the same computer, and I need two-way communication.
I have a clasic.net 4.6 console application that creates a service host:
var host = new ServiceHost(typeof(MyService), new Uri("net.tcp://localhost:8008/MyService")); var binding = new NetTcpBinding();
service contract:
[ServiceContract(CallbackContract = typeof(IMyServiceCallback))] public interface IMyService { [OperationContract(IsOneWay = true)] void Initialize(); } public interface IMyServiceCallback { [OperationContract(IsOneWay = true)] void OnFrame(int i); }
I tried both ChannelFactory and the generated wcf client using the Add Service Link dialog box and NetHttpBinding and NetTcpBinding in a UWP application.
When I try to create an instance of the wcf client, it returns the value PlatformNotSupportedExcetpion.
Source: 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()