关于的WCF服务配置文件问题
据我所知,在 IIS 中托管 WCF 服务时,该标记会被忽略。 我知道当自托管时这是必需的,但是这是否有害,甚至在 IIS 下操作时使用?
前任。
<system.serviceModel>
<service blah blah blah>
<host>
<baseAddresses>
<add baseAddress="http://localhost/blah" />
</baseAddresses>
</host>
</service>
</system.serviceModel>
据我所知,您可以从一台机器获取描述服务的配置文件,然后在完全不同的机器上使用它,并且它工作正常。 看起来 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>
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.
Thanks,
kyle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
自托管所需的基地址。 IIS/WAS 主机忽略基地址。
base address required for selfhosting. IIS/WAS hosts ignores the base address.
根据以下链接中的 MSDN Microsoft 文档,注释部分中的页面中指出,“Internet 信息服务 (IIS) 或 Windows 进程激活服务 (WAS) 下托管的服务使用虚拟目录作为其基地址。”
http://msdn.microsoft.com/en-我们/library/ee358768(v=vs.110).aspx
According to the MSDN Microsoft documentation in the below link, midway through the page in the Note section states, "Services hosted under Internet Information Services (IIS) or Windows Process Activation Service (WAS) use the virtual directory as their base address."
http://msdn.microsoft.com/en-us/library/ee358768(v=vs.110).aspx
正如您所猜测的,在 IIS 中托管时,baseAddresses 元素将被完全忽略。 该服务的基地址由网站和服务器确定。 wcf 服务所在的虚拟目录。
即使在自托管时,也不需要 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.
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).