码迷,mamicode.com
首页 > 其他好文 > 详细

WCF Host中的BaseAddress 和 Endpoint中的Address的区别

时间:2015-07-16 21:31:28      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

http://stackoverflow.com/questions/18720810/wcf-service-base-address-vs-endpoint-address

baseAddress is just that, the base address for your endpoints (unless specified explicitly).

So every <endpoint> will inherit from <baseAddress> (which is why they are usually "" and "mex"). e.g.

<baseAddresses>
<add baseAddress="http://127.0.0.1:1337/" />
</baseaddresses>
...
<endpoint address="" contract="MyService.IMyContract" ... />
<endpoint address="mex" contract="IMetadataExchange" ... />

You now have two endpoints:

http://127.0.0.1:1337/ - service endpoint
http://127.0.0.1:1337/mex - metadata endpoint
By exempting the <baseAddress> you‘re requiring the <endpoints> to both be fully qualified (including the mex (which is not)). e.g.

exempt 免除;豁免  省略了baseAddress,然后就要求endpoint中的地址是完全限定的

<baseAddresses></baseaddresses>
...
<endpoint address="net.tcp://127.0.0.1:1337/" contract="MyService.IMyContract" ... />
<endpoint address="http://127.0.0.1:1337/mex" contract="IMetadataExchange" ... />

You now have two different endpoints:

net.tcp://127.0.0.1:1337/ - service endpoint
http://127.0.0.1:1337/mex - metadata endpoint

WCF Host中的BaseAddress 和 Endpoint中的Address的区别

标签:

原文地址:http://www.cnblogs.com/chucklu/p/4652259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!