Configuring Default Endpoints
When programming with WCF, we will often need to create some simple WCF services for testing our ServiceContracts
. These services often use very simple and typical endpoint and binding definitions. However, every time we need to set up such a service, we have to define the same endpoint and binding settings again and again, which really adds much duplicated work. Fortunately, WCF 4.0 introduces the Default Endpoint feature which saves us from defining common endpoint/binding settings repeatedly.
How to do it...
The steps for using a default endpoint are quite straightforward:
Create a new Console Application project in Visual Studio 2010 targeting .NET Framework 4.0.
Add the
ServiceContract
in the service project and implementation types we need in the service project. We can use any validServiceContract
and its corresponding implementation class here. For example, the followingIHelloService
service containing a singleSayHello
operation is used in our sample...