关于< baseAddresses>的WCF服务配置文件问题 [英] WCF service configuration file question regarding <baseAddresses>
问题描述
从我看到的标签在IIS中托管WCF服务时被忽略。我理解,当自托管这是必需的,但这是有害的,甚至在IIS下运行时使用。
From what I've seen the tag is ignored when hosting a WCF service in IIS. I understand that when self-hosting this is required but is this harmful or even used when operating under IIS?
ex。
<system.serviceModel>
<service blah blah blah>
<host>
<baseAddresses>
<add baseAddress="http://localhost/blah" />
</baseAddresses>
</host>
</service>
</system.serviceModel>
根据我所见,你可以从一台机器上获取描述服务的配置文件,在一个完全不同的机器,它的工作正常。看起来IIS完全忽略了此部分。
From what I've seen you can take a config file describing a service from one machine and use that on a completely different machine and it works fine. It looks as if IIS completely ignores this section.
谢谢,
kyle
Thanks, kyle
推荐答案
正如你已经猜到的,当在IIS中托管时,baseAddresses元素被完全忽略。服务的基地址由网站&
As you have guessed, the baseAddresses element is completely ignored when hosting in IIS. The service's base address is determined by the web site & virtual directory into which your wcf service is placed.
即使在自承载的情况下,baseAddresses也不是必需的。这只是一种方便,避免您必须为每个端点输入完整地址。如果存在,则端点可以具有相对地址(相对于基地址)。
Even when self-hosting, baseAddresses is not required. It is merely a convenience that avoids you having to enter a full address for each endpoint. If it is present, the endpoints can have relative addresses (relative to the base address, that is).
这篇关于关于< baseAddresses>的WCF服务配置文件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!