Skip to content

Instantly share code, notes, and snippets.

@AlexZeitler
Created February 16, 2012 11:16
Show Gist options
  • Select an option

  • Save AlexZeitler/1844150 to your computer and use it in GitHub Desktop.

Select an option

Save AlexZeitler/1844150 to your computer and use it in GitHub Desktop.
static void Main()
{
var config = new HttpSelfHostConfiguration("http://localhost:9191");
config.Routes.MapHttpRoute("default", "{controller}/{id}",
new { id = UrlParameter.Optional });
var builder = new ContainerBuilder();
builder.Bind<ICustomerRepository, CustomerRepository>();
var container = builder.Build();
config.ServiceResolver.SetResolver(
t => container.Resolve(t),
t => container.ResolveAll(t));
var host = new HttpSelfHostServer(config);
host.OpenAsync().Wait();
Console.WriteLine(@"Host open - press any key to close");
Console.ReadLine();
host.CloseAsync().Wait();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment