2013-10-27 33 views
1

我有WCF服務使用WCF服務在WINOWS手機應用:方法返回void

當我在我的Windows Phone應用程序一切正常「添加服務引用」,但方法返回void。我測試了這個服務器,例如在WPF應用程序,它的工作原理和返回我需要的,但在WP 7/8應用程序不。當然這個WCF的基本功能是返回數據,所以無效方法對我來說完全沒用。

回答

0

您可以使用服務AsyncCompleted events.Service將在completed事件中返回數據,如

ServiceReference1.Service1Client clientForTesting = new ServiceReference1.Service1Client(); 
      clientForTesting.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(TestCallback); 
      clientForTesting.GetDataAsync(testValue); 
+0

我已經這樣做了感謝,但任何人都可以告訴我爲什麼在WPF應用程序異步方法的返回值,但在Windows手機應用程序(7或8)添加服務引用生成無效的方法:(? – Ellbar

+0

我已經這樣做,但沒有工作 –