WCF address provides two important elements:
- The location of the service: The location portion of the address indicates the name of the target machine, site, or network; a communication port, pipe, or queue; and an optional specific path or URI. A URI is a Universal Resource Identifier, and can be any unique string, such as the service name or a GUID.
- The transport protocol or transport schema used to communicate with the service.
WCF 1.0 supports the following transport schemas
- )Peer network
- IPC (Inter-Process Communication over named pipes)
Addresses always have the following format:[base address]/[optional URI]
The base address is always in this format:[transport]://[machine or domain][:optional port]
The way to read an address such as
http://localhost:8001 is like this: "Using HTTP, go to the machine called localhost, where on port 8001 someone is waiting for my calls.
If there is also a URI such as:
then the address would read as follows: "Using HTTP, go to the machine called localhost, where on port 8001 someone called
MyService is waiting for my calls."
HTTP addresses use http for transport, and can also use https for secure transport. You typically use HTTP addresses with outward-facing
Internet-based services, and can specify a port such as:
When the port number is unspecified, it defaults to 80. Similar to TCP addresses, two HTTP addresses from the same host can share a port, even on the same machine.
TCP addresses use net.tcp for the transport, and typically include a port number such as:
When a port number is not specified, the TCP address defaults to port 8080:
It is possible for two TCP addresses (from the same host, which will be discussed more later on in this chapter) to share a port:
IPC Addresses (Inter-Process Communication over named pipes)
IPC addresses use net.pipe for transport, to indicate the use of the Windows named pipe mechanism. In WCF, services that use named pipes can only accept calls from the same machine. Consequently, you must specify either the explicit local machine name or localhost for the machine name, followed by a unique string for the pipe name:
MSMQ addresses use net.msmq for transport, to indicate the use of the Microsoft Message Queue (MSMQ). You must specify the queue name. When you're dealing with private queues, you must specify the queue type, but that can be omitted for public queues:
Peer Network Address:
Peer network addresses use net.p2p for transport, to indicate the use of the Windows peer network transport. You must specify the peer network name as well as a unique path and port. Using and configuring peer networks is beyond the scope of this book, and you will see very little mention of peer networks in subsequent chapters.