public void Configuration(IAppBuilder app) { //new configuration for owin var config = new HttpConfiguration(); var enableCors = WebConfigurationManager.AppSettings["enableCors"] != null && WebConfigurationManager.AppSettings["enableCors"].ToLower() == "true"; if (enableCors) { var origins = WebConfigurationManager.AppSettings["corsAllowedOrigins"] ?? "*"; var cors = new EnableCorsAttribute(origins, "*", "GET,POST,PUT,DELETE"); config.EnableCors(cors); } ; //route registrations & other configurations WebApiConfig.Register(config); //run owin startup configurations from plugins OwinStartupManager.RunAllOwinConfigurations(app); app.MapWhen(x => x.Request.Uri.AbsolutePath.StartsWith("/" + WebApiConfig.ApiPrefix), builder => { builder.UseInstallationVerifier(); //builder.UseDryIocOwinMiddleware(mobSocialEngine.ActiveEngine.IocContainer); builder.UsePictureSizeRegistrar(); #if DEBUG builder.UseErrorPage(new ErrorPageOptions()); #endif //webapi, last one always builder.UseWebApi(config); }); app.MapWhen(x => x.Request.Uri.AbsolutePath.StartsWith("/signalr"), builder => { var userIdProvider = new SignalRUserIdProvider(); GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => userIdProvider); builder.MapSignalR(); }); }
public void Configuration(IAppBuilder app) { //new configuration for owin var config = new HttpConfiguration(); //route registrations & other configurations WebApiConfig.Register(config); #if DEBUG app.UseErrorPage(new ErrorPageOptions()); #endif //run owin startup configurations from plugins OwinStartupManager.RunAllOwinConfigurations(app); //webapi app.UseWebApi(config); //di app.UseDryIocWebApi(config); }