using System.ServiceModel; ServiceHost host = new ServiceHost(typeof(MyService)); host.Open();
using System.ServiceModel; ServiceHost host = new ServiceHost(typeof(MyService), new Uri("http://localhost:8080")); host.Open();This code creates an instance of the ServiceHost class with a base address of http://localhost:8080 for the MyService implementation class and then opens the service. Both examples show how to use the ServiceHost.Open() method to start hosting a WCF service. The System.ServiceModel namespace is the package library used in both examples.