WCF service configuration file question regarding <baseAddresses>
Asked Answered
T

3

19

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

Thacher answered 11/9, 2008 at 10:49 Comment(0)
P
35

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

Prowler answered 11/9, 2008 at 11:21 Comment(1)
So relative address endpoints wont work unless a baseAddress is specified, even though baseAddress url gets ignored?Pollute
S
2

base address required for selfhosting. IIS/WAS hosts ignores the base address.

Streak answered 21/10, 2011 at 8:24 Comment(0)
P
2

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

Paternalism answered 16/12, 2013 at 20:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.