关于<baseAddresses>的WCF服务配置文件问题 [英] WCF service configuration file question regarding <baseAddresses>

查看:19
本文介绍了关于<baseAddresses>的WCF服务配置文件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,在 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?

例如

<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.

谢谢,凯尔

推荐答案

如您所料,在 IIS 中托管时 baseAddresses 元素会被完全忽略.服务的基地址由网站确定.放置 wcf 服务的虚拟目录.

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).

这篇关于关于&lt;baseAddresses&gt;的WCF服务配置文件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆