Establishing a WCF Address

Addresses are obviously important as this allows the caller to know the location of the service. The syntax
used to express the address will differ based on the type of binding selected (HTTP-based, named pipes,
TCP-based, or MSMQ-based).

From a high level, all WCF addresses can be represented with the following template:
    •        
Scheme: The transport protocol (HTTP, TCP, etc.).
    •        
machineName: Fully qualified domain name of the machine.
    •        
Port: This is optional in many cases. The default for HTTP bindings is port 80.
    •       
 Path: The path to the WCF service.

    scheme://<machineName>[:Port]/Path

If you are using an HTTP-based protocol, the address format takes the following form. HTTPS can be used
rather than
HTTP if you require SSL connections.


http://localhost:8080/MyWcfServices/ServiceOne


If you are using an TCP-based protocol, the address format takes the following form:


net.tcp://localhost:8080/MyWcfServices/ServiceOne


If you are using an MSMQ-based protocol, the address format takes the following form. Ports have no
meaning in MSMQ-based protocols. Rather, you specify the type of queue (public, private) queue name.


net.msmq://localhost/private$/MyQ


When using named pipes, the address format takes the following form. Port numbers are not used with named
pipes.
    

net.pipe://localhost/MyWcfServices/ServiceOne


Recall that a single WCF service can expose multiple bindings. This can be very helpful when a single service
could be accessed by in-house and external callers. For example, you could configure an HTTP binding for
external callers to yield an XML web service-like experience. In-house applications could communicate with
the same service using a zipper TCP binding. Like many other aspects of WCF, multiple bindings can be
defined in *.config files or procedural code.
Establishing a WCF Address
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services