25.9. Hosting the WCF Service

You are now ready to define a host. Although you would host a production-level service from a Windows service or an IIS virtual directory, you will make your first host a simple console named MagicEightBallServiceHost.

Once you create this new Console Application project, add a reference to the System.ServiceModel.dll and MagicEightBallServiceLib.dll assemblies, and then update your initial code file by importing the System.ServiceModel and MagicEightBallServiceLib namespaces:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ServiceModel;
using MagicEightBallServiceLib; namespace MagicEightBallServiceHost { class Program { static void Main(string[] args) { Console.WriteLine("***** ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition 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.