VS2010+Silverlight4+wcf开发部署全过程

1 安装开发环境
操作系统:Windows 7 专业版 微软先锋计划199元购
Vs2010:cn_visual_studio_2010_ultimate_x86_dvd_532347.iso这是微软送的一个版本,先前在微软下载的。
银光套件:Silverlight.exe
Silverlight4_Tools.exe
Silverlight_Developer.exe
2 安装
依次安装:vs2010,完全安装
Silverlight.exe
Silverlight4_Tools.exe
Silverlight_Developer.exe,按微软说的只要安装了Silverlight4_Tools.exe,就不用安装Silverlight_Developer.exe,但是在调试程序还是要我安装Silverlight_Developer,我就有安装了它。
3 建立一个vs2010+silverlight4+wcf的项目
为了少啰嗦,大家看图吧。

























silverlight项目中的脚本
XML code
UserControl x:Class="SilverlightApplication1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <StackPanel > <TextBlock x:Name="text_result" Text="显示结果"></TextBlock> <Button x:Name="button_get_welcome" Content="测试wcf" Width="100" Click="button_get_welcome_Click" ></Button> </StackPanel> </Grid> </UserControl>

后台代码:
VB.NET code
Partial Public Class MainPage Inherits UserControl Private wcf As New ServiceReference1.Service1Client Private Sub wcf_get_wcf_welcomeCompleted(ByVal s As Object, _ ByVal e As ServiceReference1.get_wcf_welcomeCompletedEventArgs) text_result.Text = e.Result End Sub Public Sub New() InitializeComponent() AddHandler wcf.get_wcf_welcomeCompleted, AddressOf wcf_get_wcf_welcomeCompleted End Sub Private Sub button_get_welcome_Click(ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) wcf.get_wcf_welcomeAsync() End Sub End Class

wcf中添加的一段代码:
 
VB.NET code
<OperationContract()> Public Function get_wcf_welcome() As String Return "欢迎连接wcf成功。" End Function

posted @ 2010-11-29 13:44  EasyPass  阅读(1235)  评论(0编辑  收藏  举报