7.2. Default Binding, Behaviors, and Endpoints

In our previous example, we set a base address for our service to listen to (http://localhost:8888/Chapter7) with the following code, but we didn't actually create any endpoints:

ServiceHost MyServiceHost =
 new ServiceHost(typeof(Chapter7.ConfiglessService.Service1),
         new Uri("http://localhost:8888/Chapter7"));

In WCF4, if you don't specify any endpoints in code or by configuration, then WCF will automatically create a default endpoint for your service (one for each interface your service implements).

The type of endpoint that gets created is dependent on what you use as the base address. In this case, a basicHttpBinding was created, as we used an address starting with http://. However, if the address ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.