稳扎稳打Silverlight(53) - 4.0通信之对WCF NetTcpBinding的支持
2010-10-12 12:30:06 来源:WEB开发网Form1.cs
代码
// 启动 WCF 服务,用于演示 Silverlight 4.0 与 WCF 的交互(基于 NetTcpBinding 绑定)
private void LaunchNetTcpBinding()
{
ServiceHost host = new ServiceHost(typeof(SocketServer.Duplex));
host.Open();
ShowMessage("演示 NetTcpBinding 的 WCF 服务已启动");
}
客户端(需要引用服务的元数据):
NetTcpBinding.xaml
代码
<navigation:Page x:Class="Silverlight40.Communication.NetTcpBinding"
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"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
Title="NetTcpBinding Page">
<Grid x:Name="LayoutRoot">
<StackPanel HorizontalAlignment="Left">
<Button Name="btnSend" Content="发送信息到服务端" Click="btnSend_Click" />
<TextBlock Name="lblMsg" />
</StackPanel>
</Grid>
</navigation:Page>
Tags:稳扎稳打 Silverlight 通信
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››稳扎稳打Silverlight(53) - 4.0通信之对WCF NetTc...
- ››稳扎稳打Silverlight(54) - 4.0通信之对UDP协议的...
- ››稳扎稳打Silverlight(55) - 4.0通信之对UDP协议的...
- ››稳扎稳打Silverlight(56) - 4.0通信之与 WCF Data...
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
更多精彩
赞助商链接