TopAddress In Wcf
Each address type can have different formats as shown in Figure 1. As shown in Figure 1, the left hand side contains three type addresses and each address can be written by using different formats of address mentioned in right hand side of the Figure 1. This figure clears the ambiguity between the address type and address format. An address contains several components which can be understood by following example.
The address in the below example is divided into three parts mentioned as numbers 1, 2 and 3.
TopType Of Address
There are three types of addresses available in WCF and each of these addresses are explained in the following section.
(A) Endpoint Address
It is the address of endpoint through which client and service can communicate. Once the client is connected to the service through one endpoint all the other communications between them is done through the same endpoint. The example of the endpoint is shown as:
Every service must have at least one endpoint with absolute address as shown above.
(B) Base Address
It is also known as primary address which works as base address for one or more endpoints. In the presence of a base address endpoint address can be relative. If the base address is not available endpoint address must be absolute. For instance, following is the base address:
Suppose there are three endpoints having a relative address as below:
- •
Endpoint 1: s1
- •
Endpoint 2: s2
- •
Endpoint 3: s3
Then the actual addresses of the endpoints are considered as:
- •
Endpoint 1: http://localhost/Service/s1
- •
Endpoint 2: http://localhost/Service/s2
- •
Endpoint 3: http://localhost/Service/s3
The base address cannot be relative. If the endpoint address and base address both are absolute then both are not considered as same and not related with each other.