添加对 silverlight 应用程序的 Web 引用

发布于 2024-12-08 15:11:12 字数 568 浏览 0 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小忆控 2024-12-15 15:11:12

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

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

该事件处理程序将如下所示:

private void MyProxy_GetMyClientCompleted(object sender, GetMyClientCompletedEventArgs e)
{
    //e.Result will have your returned values
}  

这只是一个非常简短的概述,足以让您入门。您还可以在这里阅读更多信息: 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 called GetMyClientAsync(), and it will also have an event called GetMyClientCompleted which you must subscribe to:

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

that event handler will look something like this:

private void MyProxy_GetMyClientCompleted(object sender, GetMyClientCompletedEventArgs e)
{
    //e.Result will have your returned values
}  

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文