Skip to content

Instantly share code, notes, and snippets.

@fabriciosanchez
Created May 26, 2014 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabriciosanchez/b5b54b966597a8ed42e3 to your computer and use it in GitHub Desktop.
Save fabriciosanchez/b5b54b966597a8ed42e3 to your computer and use it in GitHub Desktop.
Host Web API
static void Main()
{
var baseAddress = new Uri("http://localhost:5000");
var config = new HttpSelfHostConfiguration(baseAddress);
config.Routes.MapHttpRoute("default", "{controller}");
using (var svr = new HttpSelfHostServer(config))
{
svr.OpenAsync().Wait();
Console.WriteLine("Press Enter to quit.");
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment