1.服务端配置如下(一个Service节点下可有多个endpoint,):

  <system.serviceModel>
<services>
<service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="returnFaults">
<endpoint address="http://localhost:8000/GIX4" binding ="customBinding"
bindingConfiguration="compactBindingConfig" contract="Microsoft.ServiceModel.Samples.ICalculator"/>
<endpoint address="basic" binding="basicHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator"></endpoint>
<!--前面加个basic基址就变成了http://localhost:8000/GIX4/basic-->
<endpoint address="secure" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/GIX4"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>

2. 客户端配置:

    <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICalculator" />
</basicHttpBinding>
<customBinding>
<binding name="CustomBinding_ICalculator">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_ICalculator" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8000/GIX4" binding="customBinding"
bindingConfiguration="CustomBinding_ICalculator" contract="Calculator.Service.ICalculator"
name="CustomBinding_ICalculator" />
<endpoint address="http://localhost:8000/GIX4/basic" binding="basicHttpBinding"
contract="Calculator.Service.ICalculator"
name="basic" />
<endpoint address="http://localhost:8000/GIX4/secure" binding="wsHttpBinding"
contract="Calculator.Service.ICalculator"
name="secure"> <!--加上一个名字-->
<identity>
<userPrincipalName value="chenlh@huawei" />
</identity>
</endpoint>
</client>
</system.serviceModel>

3.客户端声明如下:

CalculatorClient client = new CalculatorClient("basic");

WCF之多个终结点的更多相关文章

  1. 客服端调用自定义宿主的WCF报错"没有终结点在侦听可以接受消息的http://localhost:8085/mex。这通常是由于不正确的地址或者 SOAP 操作导致的错误"的解决方案。

    没有终结点在侦听可以接受消息的http://localhost:8085/mex.这通常是由于不正确的地址或者 SOAP 操作导致的错误. 这个错误是由于没有启动元数据交换终结点(MEX)导致的.在宿 ...

  2. [SL] Silverlight + WCF Demo项目

    I:项目描述:利用 Silverlight+WCF 技术,模拟资源管理器(如图1)功能,通过地址栏输入本地文件夹路径,然后将解析出来的该目录下所有文件(夹)存储到数据库中,然后再加载到界面上显示出来: ...

  3. WCF入门教程(五)配置文件

    WCF入门教程(五)配置文件 服务协定以及实现写好后,需要将相关服务公布出去,就需要HOST来承载,供客户端来调用. 承载服务有两种方式,一种通过配置文件,一种通过代码进行配置.上一章已经介绍了代码方 ...

  4. WCF

    --http://www.doc88.com/p-699300196010.html ---术语 WCF术语 消息(message) 消息是一个独立的数据单元,它可能由几个部分组成,包括消息正文和消息 ...

  5. 第三讲:WCF介绍(3)

    代码 https://yunpan.cn/cPns5DkGnRGNs   密码:3913   前面我们通过一个小的例子,大概了解的WCF. 这里我们补充下  EndPoint 配置  A,B,C  中 ...

  6. WCF第二天

    消息  : 消息是一个独立的数据单元,它可能由几个部分组成,包括消息正文和消息头.     服务  :  服务是一个构造,它公开一个或多个终结点,其中每个终结点都公开一个或多个服务操作.   终结点 ...

  7. 从开发的角度比较 ASP.NET Web 服务与 WCF

    Windows Communication Foundation (WCF) 具有一个 ASP.NET 兼容模式选项,用户使用此选项可以对 WCF 应用程序进行编程和配置,使其像 ASP.NET We ...

  8. WCF学习心得------(二)设计和实现服务协定

    设计和实现服务协定 创建服务协定—WCF术语 消息 消息是一个独立的数据单元,它可能由几个部分组成,包括消息正文和消息头. 服务 服务是一个构造,它公开一个或多个终结点,其中每个终结点都公开一个或多个 ...

  9. WCF分布式开发步步为赢(4):WCF服务可靠性传输配置与编程开发

    今天继续WCF分布式开发步步为赢系列的第4节:WCF服务可靠性传输配置与编程开发.这个章节,我们要介绍什么是WCF服务的可靠性传输,随便介绍网络协议的概念,Web Service为什么不支持可靠性传出 ...

随机推荐

  1. js——倒计时

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. AES加密 16进制与二进制转换

    import java.security.Key; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax ...

  3. CSS 去除列表项li前面的小圆点

    前言 在默认的情况下,浏览器会在<li>标签前面加上小圆点形成列表项,如下所示使用<ul> 项1 项2 项3 或者使用<ol> 项1 项2 项3 这在有时候确实给我 ...

  4. python 爬虫

    import urllib2 as url import re urls = 'http://www.php100.com/html/it/' headers = {'User-Agent':'Moz ...

  5. 如何在 Ubuntu 15.04 系统中安装 Logwatch

    大家好,今天我们会讲述在 Ubuntu 15.04 操作系统上如何安装 Logwatch 软件,它也可以在各种 Linux 系统和类 Unix 系统上安装.Logwatch 是一款可定制的日志分析和日 ...

  6. linux 执行php文件

    /opt/php5/bin/php /home/Xcar/tag/interface/tag_api4hbase.php tag_export2file "/tmp/guo.php" ...

  7. UTF-8

    UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,又称万国码.由Ken Thompson于1992年创建.现在已经标准化为 ...

  8. iOS产品开发流程

    iOS产品开发流程 a.产品经理做需求调研,确定产品需求,编写需求文档 b.产品人员完成产品原型 c.产品经理召开会议(产品,UI,UE,开发,测试,服务器) d.设计人员根据原型设计出一系列UI界面 ...

  9. 转: HTML的电子邮件链接标签mailto用法详解

    mailto是网页设计制作中的一个非常实用的html标签,许多拥有个人网页的朋友都喜欢在网站的醒目位置处写上自己的电子邮件地址,这样网页浏览者一旦用鼠标单击一下由mailto组成的超级连接后,就能自动 ...

  10. LCD驱动 15-1

    app: read() ---------------------------------------------------------------------------------------- ...