In WCF 3/3. 5, when we want to call a service, we must first know the address of the service, and then use the contract agreed by both parties to interact with the remote service through the Service proxy. Currently, WCF 4.0 provides support for the Discovery Service. When we want to call another service, there is no need to know the specific address of the service, WCF 4.0 implements the WS-discovery standard of oasis, and the related classes are defined in system. servicemodel. discovery namespace. This is a separateProgramSo you need to add a reference to it. You only need to use the relevant classes in the system. servicemodel. Discovery namespace to implement two methods of dynamic Discovery Service:
Ad hoc mode: it is easy to understand, that is, when the service is started, the Hello message is broadcast to the network. After receiving the message, the caller responds to establish a communication mode.
Managed mode: simply put, it means that all services are registered in a place called the discovery proxy in advance, and then all callers send a search request to the Discovery proxy to find and call the relevant service mode.
To dynamically discover services in WCF 4.0, it is relatively simple to use ad hoc mode. For managed mode, you must inherit the abstract class system. servicemodel. Discovery. discoveryproxy to implement your own discovery proxy.
WS-discovery 1.1 Specification: Http://docs.oasis-open.org/ws-dd/discovery/1.1/ OS /wsdd-discovery-1.1-spec-os.html
Discovery concepts: Http://blogs.msdn.com/discovery/archive/2009/05/29/discovery-overview.aspx
WCF discovery: Http://msdn.microsoft.com/en-us/library/dd456782 (vs.100). aspx
WS-discovery for WCF: Http://www.codeproject.com/KB/WCF/ws-discovery.aspx