如何将 Web 应用程序类访问到 Silverlight 应用程序中 [英] How to access web application class into silverlight application

查看:20
本文介绍了如何将 Web 应用程序类访问到 Silverlight 应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Silverlight 的初学者……我创建了一个 Silverlight 项目.创建新的 Silverlight 项目时,它会自动创建一个 Silverlight 应用程序和一个 Web 应用程序.我在两个应用程序中都添加了一个类.现在我想将 Web 应用程序类的一个方法访问到 Silverlight 应用程序类中.是否可以?我曾尝试将 Web 应用程序引用添加到 Silverlight,但 VS 不允许.还有其他方法吗??

I am beginner in silverlight..I have created a silverlight project. When a new silverlight project is created it is automatically creating a silverlight application and one web application. I have added a class in both applications. Now I want to access a method of web application class into silverlight application class. Is it possible? I have tried to add web application reference to silverlight but VS is not allowing. Is there any another way to do??

推荐答案

你需要的是 WCF.在这里可以找到一个非常简单的教程,可以帮助您入门:如何从 Silverlight 调用 WCF 方法控制

What you need is called WCF. A really simple tutorial that should get you going is found here: How to call WCF methods from Silverlight controls

从根本上说,WCF 允许 Silverlight 客户端对托管在网站上的类实例进行方法调用.

Fundementally WCF allows the silverlight client to make method calls on a class instance hosted on the web site.

这篇关于如何将 Web 应用程序类访问到 Silverlight 应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆