C# 向silverlight应用程序添加web引用

C# 向silverlight应用程序添加web引用,c#,silverlight,reference,web,C#,Silverlight,Reference,Web,我是silverlight的新手,我想向silverlight应用程序添加web引用,这可能吗 我只能向SilverlightApplication添加服务引用,但我想添加web引用 我可以向SilverlightApplication添加web引用。web,我可以从SilverlightApplication使用它吗 我也可以向Silverlight应用程序添加服务引用,但是服务引用的函数没有返回值,因此我无法接收数据,下面是代码 Service1SoapClient c=新的Service1

我是silverlight的新手,我想向silverlight应用程序添加web引用,这可能吗

我只能向SilverlightApplication添加服务引用,但我想添加web引用

我可以向SilverlightApplication添加web引用。web,我可以从SilverlightApplication使用它吗

我也可以向Silverlight应用程序添加服务引用,但是服务引用的函数没有返回值,因此我无法接收数据,下面是代码 Service1SoapClient c=新的Service1SoapClient()

函数returnStr_19_9Async(“”)没有返回值。有人能告诉我出了什么问题吗?? 你能告诉我怎么做吗?请解释一下


谢谢。

您可能会注意到的问题是,WCF调用都是在Silverlight中异步完成的。这意味着当您调用初始服务函数(我们称之为
GetMyClient(int-clientId)
)时,您生成的代理将有一个名为
getmyclientsync()
的函数,它还将有一个名为
GetMyClientCompleted
的事件,您必须订阅该事件:

myProxy.GetMyClientCompleted += new EventHandler<GetMyClientCompletedEventArgs>(MyProxy_GetMyClientCompleted);

这只是一个非常简短的概述,足以让您开始。您还可以在此处阅读更多内容:

是否尝试添加服务引用?好吧,我可以添加服务引用,但我不知道如何使用它,你能解释一下吗服务引用的问题是它没有返回值函数,所以我不能用它来接收web数据这就是问题所在
myProxy.GetMyClientCompleted += new EventHandler<GetMyClientCompletedEventArgs>(MyProxy_GetMyClientCompleted);
private void MyProxy_GetMyClientCompleted(object sender, GetMyClientCompletedEventArgs e)
{
    //e.Result will have your returned values
}