WCF寻址

1.如果在<System.ServiceModel>.<Services>.<Service>.<host>.<baseaddress>定义了基址那么寻址有以下几种情况

 1 第三个终结点定义指定一个绝对地址,如下面的示例配置所示。
 2 <endpoint address="http://localhost:8001/hello/servicemodelsamples"
 3           binding="wsHttpBinding"
 4           contract="Microsoft.ServiceModel.Samples.ICalculator" />
 5 
 6 !-- The relative address specified: use the base address -->
 7 <!-- provided by the host + path. The endpoint address is -->
 8 <!-- http://localhost:8000/servicemodelsamples/service/test. -->
 9 <endpoint address="/test"
10           binding="wsHttpBinding"
11           contract="Microsoft.ServiceModel.Samples.ICalculator" />

在终结点还可以指定一个绝对地址和一个不同的传输协议 (TCP)。基址在地址中不起作用。实际终结点地址为 net.tcp://localhost:9000/servicemodelsamples/service。
<!-- The absolute address specified, different transport: -->
<!-- use the specified address, and ignore the base address. -->
<!-- The endpoint address is -->
<!-- net.tcp://localhost:9000/servicemodelsamples/service. -->
<endpoint address=
          "net.tcp://localhost:9000/servicemodelsamples/service"
          binding="netTcpBinding"
          contract="Microsoft.ServiceModel.Samples.ICalculator" />
</service>
 全址:终结点是否有全址? 终结点中的全址 :基址+终结点中的相对地址
原文地址:https://www.cnblogs.com/lihongchen/p/3607902.html