我WebMethod
在后端 Web 服务中编写了一个简单的。我在 WPF 应用程序和 Silverlight 应用程序中都使用它作为服务引用。
该方法返回一个List<string>
被调用的userList
. 这在 WPF 应用程序中运行良好,我在其中将其引用Service1SoapClient
为“客户端”。因此通过-调用该方法
client.userlist(); //this is the case in WPF app
然而,在 Silverlight 中,唯一的选择是
client.userListAsync(); //Silverlight
这在 WPF 中工作正常并带回所需的列表,但是 Silverlight 带回错误 -
Error 11 Cannot implicitly convert type 'void' to 'System.Collections.Generic.List<string>'
同样与此相关的是,在 WPF 应用程序中,我正在使用 userList 附加带有richTextBox 的文本,这可以工作,但是在 SilverlightrichTextBox1.AppendText
中不是一个有效的选项。
Silverlight 应用程序哪里出错了?