使用WCF服务在Windows Phone应用程序:方法返回void

问题描述 投票:1回答:1

我有WCF服务

当我在Windows的“添加服务引用”的手机应用程序的一切看起来不错,但方法返回void。我测试了这台服务器,例如在WPF应用程序和它的工作并返回我需要什么,但在WP 7/8的应用程序没有。 Ofcourse这个WCF的基本功能是返回数据,以便void的方法是完全无用的我。

wcf windows-phone
1个回答
0
投票

您可以使用服务AsyncCompleted events.Service会像completed事件中返回数据

ServiceReference1.Service1Client clientForTesting = new ServiceReference1.Service1Client();
            clientForTesting.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(TestCallback);
            clientForTesting.GetDataAsync(testValue);
© www.soinside.com 2019 - 2024. All rights reserved.