When you also want to expose metadata without a config file you can build on the example programmatically creating a ServiceHost:
public ConsoleHost()
{
mHost = new ServiceHost(typeof(Example), new Uri("http://localhost:8000/Example"), new Uri("net.tcp://9000/Example"));
...