hiddenUser
hiddenUser

Reputation: 692

WCF Base Addresses

What is the difference between the service base address and the endpoint base address?

Suppose i have a base address for the service like this: "http://hostname:port/svc1" and the endpoint of the service is configured with the NetMsmqBinding which requires a transport scheme "net.msmq" and not "http". This would result into an exception from the WCF runtime, right?

But then, this means that all endpoints of a service must conform to the transport scheme specified in the service base address, right?

Can somebody please help solve this ambiguity?

Upvotes: 1

Views: 270

Answers (1)

marc_s
marc_s

Reputation: 754778

You can have one base address per scheme - so you can define one base address for http, another for net.tcp and so on.

The base address is the base of the address - each endpoint will have to provide a relative address which gets added to this base address:

  • Base address for http: http://hostname:port/svc1
  • Base address for net.tcp: net.tcp://hostname:port/tcp

  • Endpoint 1: address="test1" --> complete URL http://hostname:port/svc1/test1

  • Endpoint 2: address="test2" --> complete URL http://hostname:port/svc1/test2

  • Endpoint 1 for net.tcp: address="tcp1" --> complete URL net.tcp://hostname:port/tcp/tcp1

  • Endpoint 2 for net.tcp: address="tcp2" --> complete URL net.tcp://hostname:port/tcp/tcp2

And of course, even with a base address in place, if the endpoint defines it's own, complete address, then that address will be used:

  • Endpoint 3: address="http://hostname:port2/OtherService/EP1" --> in that case, since a complete address is specified , the defined base address for http does not apply and this fully qualified address IS the actual, complete endpoint address

Upvotes: 3

Related Questions