// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { MiniPeerConfiguration config = null; // load config file if (File.Exists(ConfigFileName)) { config = JsonConvert.DeserializeObject <MiniPeerConfiguration>(File.ReadAllText(ConfigFileName)); } else { File.WriteAllText(ConfigFileName, JsonConvert.SerializeObject(new MiniPeerConfiguration())); } var serverContext = new ServerContext(config); app.Map("/ws", a => WebSocketHandler.Map(a, serverContext)); app.UseOwin(x => x.UseNancy(options => options.PassThroughWhenStatusCodesAre( HttpStatusCode.NotFound, HttpStatusCode.InternalServerError ))); }