protected override void OnStart()
{
base.OnStart();
var owinhost =
Application.PeerCast.OutputStreamFactories.FirstOrDefault(factory => factory is OWINHostOutputStreamFactory) as OWINHostOutputStreamFactory;
if (owinhost!=null) {
applications.AddRange(
virtualPhysicalPathMap.Keys.Select(path =>
owinhost.AddApplication(path, PathParameters.Any, OnProcess)));
applications.Add(owinhost.AddApplication("/", PathParameters.None, OnRedirect));
}
}