添加对 silverlight 应用程序的 Web 引用
我是 silverlight 新手,我想添加对 silverlight 应用程序的 Web 引用,可以吗???
我只能添加对 SilverightApplication 的服务引用,但我想添加 Web 引用。
我可以添加对 SilverightApplication.Web 的 Web 引用,我可以从 SilverightApplication 使用它吗?
我也可以向 SilverightApplication 添加服务引用,但服务引用的函数没有返回值,所以我无法接收数据,这里是代码 Service1SoapClient c = new Service1SoapClient();
ServiceReference1.Service1SoapClient a = new ServiceReference1.Service1SoapClient();
a.returnStr_19_9Async("");
函数 returnStr_19_9Async("") 没有返回值,任何人都可以告诉我出了什么问题吗? 你能告诉我怎么做吗,请解释一下..
谢谢。
I'm new to silverlight, I want to add web reference to silverlight application is that possable???
I can only add service reference to the SilverightApplication but i want to add web reference.
I can add web reference to the SilverightApplication.Web, can i use it from SilverightApplication??
I aslo can add service reference to the SilverightApplication but functions of service reference has no return value so i cant recieve the data, here is the code
Service1SoapClient c = new Service1SoapClient();
ServiceReference1.Service1SoapClient a = new ServiceReference1.Service1SoapClient();
a.returnStr_19_9Async("");
the function returnStr_19_9Async("") has no return value can any one please tell me what is teh wrong??
Can you please tell me how, please explain..
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能会遇到的问题是,WCF 调用在 Silverlight 中都是异步完成的。这意味着当您调用初始服务函数(我们称之为
GetMyClient(int clientId)
)时,您生成的代理将具有一个名为GetMyClientAsync()
的函数,并且它还将有一个名为GetMyClientCompleted
的事件,您必须订阅该事件:该事件处理程序将如下所示:
这只是一个非常简短的概述,足以让您入门。您还可以在这里阅读更多信息: Silverlight.net |数据与网络|网络服务(Soap、REST 等)
The problem you may be striking is that WCF calls are all done asynchronously in Silverlight. This means when you call your initial service function (let's call it
GetMyClient(int clientId)
), the proxy that you have generated will have a function calledGetMyClientAsync()
, and it will also have an event calledGetMyClientCompleted
which you must subscribe to:that event handler will look something like this:
This is just a very brief overview that gives you enough to get started. You could also read more here: Silverlight.net | Data & Networking | Network Services (Soap, REST and More)