My Windows 8.1 app uses WCF services. I need to port my app to Windows 10 UWP app. But cannot add service reference. This message appears when I add a service reference:
Data service client code-generation failed. Specified Windows Store Framework '.NETCore,Version=v5.0' is not supported. Only .NETCore 4.5 and above is supported.
How to solve my problem?
Press Ctrl + F5 to run the service. Open WCF Test Client. To open WCF Test Client, open Developer Command Prompt for Visual Studio and execute WcfTestClient.exe. Select Add Service from the File menu.
Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.
A windows service is what you need. WCF is a communications library, and unless you plan to communicate with your application via a client, you don't need it. Your problem is related to activation, and keeping your code active in the background is what windows services do.
Thank you for @gregkalapos
1. Create Windows 8.1 Portable class library
2. Choose like this
3. Add Service Reference to newly created library. Then reference library to Windows 10 Universal App project.
This is example call method:
var client = new ConnectODataEntities(new Uri("http://...ODATA URL..."));
var dsQuery = (DataServiceQuery<YOUR_METHOD_RETURN_TYPE>)(client.YOUR_METHOD);
var tf = new TaskFactory<IEnumerable<YOUR_METHOD_RETURN_TYPE>>();
var list = (await tf.FromAsync(dsQuery.BeginExecute(null, null),
iar => dsQuery.EndExecute(iar))).ToList();
lbox.ItemsSource = list;
This method used app works on
Windows 10
andWindows 10 Mobile
I also have this problem. The workaround I used was that I created a Portable Class Library targeting only Windows Runtime and added the service reference into that and I referenced the PLC in the UWP app. Btw. I think this is a known bug...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With