How can I use a duplex WCF service in my UWP app?
Every time I create a InstanceContext
it throws PlatformNotSupportedExcetpion: Operation is not supported on this platform.
I have two applications that share the same code to connect to the WCF service. One of them is a UWP app, the other one a normal Desktop app.
var callback = new JuqeServiceCallback();
var binding = new NetTcpBinding(SecurityMode.None) { MaxBufferSize = 10485760, MaxBufferPoolSize = 10485760, MaxReceivedMessageSize = 10485760 };
var address = new EndpointAddress("net.tcp://localhost/Juqe/Service.svc");
var factory = new DuplexChannelFactory<IJuqeService>(new InstanceContext(callback), binding, address); // PlatformNotSupported exception gets thrown
The interfaces:
[ServiceContract(CallbackContract = typeof(IJuqeServiceCallback))]
public interface IJuqeService {...}
public interface IJuqeServiceCallback {...}
The callback:
[CallbackBehavior]
public class JuqeServiceCallback : IJuqeServiceCallback {...}
Side notes:
NETCore.UniversalWindowsVersion version: 5.2.2
Target/Min version: 10.0; Build 10586
.NET version: 4.6.1
Visual Studio version: 2015
I followed the solutions from this question: How to consume duplex wcf service in Windows Universal App
They didn't worked.
I also created a new, blank UWP app (Traget/min version 10.0; Build 14393), updated the NETCore.UniversalWindowsVersion to 5.2.2 and tried it again. Same error.
There is the option to update the NETCore..UniversalWindowsVersion to 5.3 but I have to install VS 2017 for it. Will this fix the error?