Hosting WebApi On OwinHost.exe (Sans IIS)

Startup:

[assembly: OwinStartup(typeof(OwinWebOnOwinHost.Startup))]
namespace OwinWebOnOwinHost {
	public class Startup {
		public void Configuration(IAppBuilder app) {
			var config = new MyHttpConfiguration();
			app.UseWebApi(config);
		}
	}
 
	public class MyHttpConfiguration : HttpConfiguration {
		public MyHttpConfiguration() {
			ConfigureRoutes();
			ConfigureJsonSerialization();
		}
 
		private void ConfigureRoutes() {
			Routes.MapHttpRoute(
					name: "DefaultApi",
					routeTemplate: "api/{controller}/{id}",
					defaults: new { id = RouteParameter.Optional }
			);
 
			Routes.MapHttpRoute("default", "{controller}/{action}/{id}", new { id = RouteParameter.Optional });
		}
 
		private void ConfigureJsonSerialization() {
			var jsonSettings = Formatters.JsonFormatter.SerializerSettings;
			jsonSettings.Formatting = Formatting.Indented;
			jsonSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
		}
	}

Nuget:

1. Microsoft.AspNet.WebApi.Owin||
2. OwinHost (for the OwinHost.exe)

Run the executable, using the –d option to specify the root of web directory:
owinhost -d “c:UsersQerimDocumentsVisual Studio 2013ProjectsOwinSelfHostOwinWebOnOwinHost”

At the time of writing, it is possible to host WebAPI and SignalR with standalone Owin, but not MVC. For that, we need to pull in Microsoft.AspNet.Host.SystemWeb which basically enables the Owin pipeline in IIS. In that picture, IIS is the server and the host, but we get to plug middleware into the owin pipeline which is how Identity has been implemented.