Welcome

首页 / 软件开发 / WCF / WCF示例(3) - 绑定Binding(basicHttpBinding和netTcpBinding)

WCF示例(3) - 绑定Binding(basicHttpBinding和netTcpBinding)2012-01-20 webabcd 介绍

WCF(Windows Communication Foundation) - 绑定Binding:Http以basicHttpBinding为例,Tcp以netTcpBinding为例。

示例

1、服务

IHello.cs

using System;using System.Collections.Generic;using System.Linq;using System.Text;  using System.ServiceModel;  namespace WCF.ServiceLib.Binding{  /**//// <summary>  /// IHello接口  /// </summary>  [ServiceContract]  public interface IHello  {    /**//// <summary>    /// 打招呼方法    /// </summary>    /// <param name="name">人名</param>    /// <returns></returns>    [OperationContract]    string SayHello(string name);  }}