I met with WCF (mm) and basically understood the situation of WCF. I said hello to her and found that she liked her very much, how can I find her in the future? haha, WCF (MM) provided me with the address for finding it. Haha, envy? Let's get down to the truth and start learning about the address of WCF ).
Each service in WCF has a unique address (addresses ). the address includes two important elements: the service location and the transmission protocol (see the MM meeting place and the dark sign next time, which is a bit inappropriate) or the transmission style used for service communication. The service location includes the target machine name, site or network, communication port, pipeline or queue, and an optional specific path or Uri. Uri and unified resource representation. It can be any uniquely identified string, such as the service name or GUID. For example, in the client of the simple WCF instance in the previous step: http: // localhost: 5509/Hello. SVC
< Client >
< Endpoint Address = "Http: // localhost: 5509/Hello. SVC" Binding = "Basichttpbinding" Bindingconfiguration = "Basichttpbinding_ihello" Contract = "Servicereference1.ihello" Name = "Basichttpbinding_ihello" />
</ Client >
Address is represented by the system. servicemodel. endpointaddress object in WCF. Its structure is as follows:
Address components and their functions:
1. Uri: indicates the endpoint address, which is required.
2. Identity: Ensure the uniqueness of the address. When the URI is consistent, you can use identity to differentiate the endpoint.
3. headers: provides some additional information for the address, used for SOAP message filter, and is finally added to the header of the SOAP message.
4. In addition, the address includes the isanonymous attribute to indicate whether the end node can be accessed anonymously.
The address styles supported by WCF are as follows:
1. HTTP,
2. TCP,
3. Peer Network (peer network ),
4. IPC (pipeline-based internal process Communication ),
5. MSMQ (Microsoft Message Queue)
The address format is as follows:
[Base address]/[Optional URI]
The basic address format is as follows:
[Transfer Protocol]: // [machine name or domain name] [: Optional port]
HTTP address:
HTTP uses the HTTP protocol for transmission. You can also use https for secure transmission. The HTTP address is usually used as an Internet-based service and a port number is specified for it. For example: http: // localhost: 8001. If no port is specified, port 80 is used by default. Two HTTP addresses of the same host can share one port or even the same machine.
TCP address:
The TCP address uses net. TCP transmission, usually including the port number, for example: net. TCP: // localhost: 8002/myservice. If no port number is specified, the default port number is 808:
Net. TCP: // localhost/myservice. Two TCP addresses (from the same host) can share one port.
IPC address:
The IPC address is transmitted using net. pipe, which means that it will use the naming Pipeline mechanism of windows. In WCF, services using named pipelines can only be called from the same machine. Therefore, you must specify a specific local machine name or name it localhost to provide a unique string for the pipeline name: net. Pipe: // localhost/mypipe. Each machine can only open one named pipe. Therefore, two named pipe addresses cannot share one pipe name on the same machine.
MSMQ address:
MSMQ uses net. MSMQ for transmission and Microsoft Message Queue (MSMQ) mechanism. The queue name must be specified for the MSMQ address. For private queues, the queue type must be specified. For public queues, the queue type can be omitted: net. MSMQ: // localhost/private/myservice net. MSMQ: // localhost/myservice.
Peer network address (peer network address ):
Net. P2P is used for transmission. It uses the equivalent network transmission mechanism of windows. If the parser is not used, we must specify the peer network name, unique path, and port for the peer network address. (Rarely used)