我的Windows 8.1应用程序使用WCF服务.我需要将我的应用程序移植到Windows 10 UWP应用程序.但不能添加服务参考.当我添加服务引用时,将显示以下消息:
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:
数据服务客户端代码生成失败.不支持指定的Windows Store Framework'.NETCore,Version = v5.0'.仅支持.NETCore 4.5及更高版本.
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.
如何解决我的问题?
推荐答案感谢@gregkalapos
Thank you for @gregkalapos
1.创建Windows 8.1可移植类库
2.选择这样
3.将服务引用添加到新创建的库.然后将库引用到Windows 10 Universal App项目.
这是示例调用方法:
var client = new ConnectODataEntities(new Uri("...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;使用此方法的应用程序可在 Windows 10 和 Windows 10 Mobile
更多推荐
如何在Windows 10 Universal App中使用WCF服务?
发布评论