public void Configuration(IAppBuilder app) { ConfigureAuth(app); app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); map.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions() { Provider = new QueryStringOAuthBearerProvider() }); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain // EnableJSONP = true Resolver = GlobalHost.DependencyResolver }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); }
public void Configuration(IAppBuilder app) { Logger.Info("SignalR: Configuration has been entered"); GlobalHost.HubPipeline.AddModule(new ErrorHandlingPipelineModule()); app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain EnableJSONP = true, EnableDetailedErrors = true }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); Logger.Info("SignalR: Configured"); }
public void Configuration(IAppBuilder app) { // Turn cross domain on var config = new HubConfiguration { EnableCrossDomain = true }; // This will map out to http://localhost:8080/signalr by default app.MapHubs(config); }
public void Configuration(IAppBuilder app) { // Make sure the database is updated to the latest version. This effectively runs Update-Database, even when running in Azure. Database.SetInitializer(new MigrateDatabaseToLatestVersion<KiwiContext, Configuration>()); var config = new HttpConfiguration(); ConfigureOAuth(app); // Set up Owin to use the WebAPI's config WebApiConfig.Register(config); app.UseCors(CorsOptions.AllowAll); app.Map("/signalr", map => { map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain // EnableJSONP = true }; map.RunSignalR(hubConfiguration); }); app.UseWebApi(config); }
public void Configuration(IAppBuilder app) { //worsks to client //app.UseCors(CorsOptions.AllowAll); //app.MapSignalR(); //not working // Branch the pipeline here for requests that start with "/signalr" app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { Resolver = new AutofacSignalRDependencyResolver(App.Container), }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); }
public static IWindsorContainer Configure( this IWindsorContainer container, HubConfiguration configuration, IAppBuilder app) { configuration.Resolver = new SignalRDependencyResolver(container); container.Register( Component .For<IHubConnectionContext<dynamic>>() .UsingFactoryMethod(k => configuration.Resolver.Resolve<IConnectionManager>() .GetHubContext<ClientsHub>().Clients) ); container.Register( Classes .FromAssemblyContaining<Startup>() .BasedOn<IHub>() .WithServiceSelf() .LifestyleSingleton() ); app.MapSignalR(configuration); return container; }
public void Configuration(IAppBuilder app) { var httpConfig = new WebApiHttpConfiguration(); app.UseWebApi(httpConfig); // Branch the pipeline here for requests that start with "/signalr" app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. By default this will allow all origins. // You can configure the set of origins and/or http verbs by providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration(); // handle custom serilaization for lowerCamelCase var settings = new JsonSerializerSettings { ContractResolver = new SignalRContractResolver() }; var serializer = JsonSerializer.Create(settings); GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer); // Run the SignalR pipeline. We're not using MapSignalR since this branch already runs under the "/signalr" path. map.RunSignalR(hubConfiguration); }); // for static files: Install-Package Microsoft.Owin.StaticFiles //var fileServerOptions = new FileServerOptions {}; //app.UseFileServer(fileServerOptions); }
public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 HubConfiguration config = new HubConfiguration { EnableDetailedErrors = true, Resolver = new DefaultDependencyResolver() }; app.UseCors(CorsOptions.AllowAll); app.MapSignalR(config); }
public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 // Branch the pipeline here for requests that start with "/signalr" app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain // EnableJSONP = true }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); HttpConfiguration httpConfig = new HttpConfiguration(); ConfigureOAuthTokenGeneration(app); ConfigureWebApi(httpConfig); app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); app.UseWebApi(httpConfig); }
public void Configuration(IAppBuilder app) { // 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888 app.Map("/signalr", map => { // Setup the cors middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain EnableJSONP = true }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch is already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); }
public void Configuration(IAppBuilder app) { var configuration = new HubConfiguration(); configuration.EnableDetailedErrors = true; configuration.Resolver = new SignalRDependencyResolver(); app.MapSignalR(configuration); }
public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); app.UseStatusCodePages(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new {controller = "Home", action = "Index"}); }); app.UseOwin(addToPipeline => { addToPipeline(next => { var builder = new AppBuilder(); var hubConfig = new HubConfiguration { EnableDetailedErrors = true }; builder.MapSignalR(hubConfig); var appFunc = builder.Build(typeof(Func<IDictionary<string, object>, Task>)) as Func<IDictionary<string, object>, Task>; return appFunc; }); }); }
public void Configuration(IAppBuilder app) { var formatters = GlobalConfiguration.Configuration.Formatters; var jsonFormatter = formatters.JsonFormatter; var settings = jsonFormatter.SerializerSettings; settings.Formatting = Formatting.Indented; settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); app.UseCors(CorsOptions.AllowAll); ConfigureAuth(app); // app.MapSignalR(); app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { // You can enable JSONP by uncommenting line below. // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain // EnableJSONP = true EnableDetailedErrors = true }; // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the "/signalr" // path. map.RunSignalR(hubConfiguration); }); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 //JSOP config //var config = new ConnectionConfiguration() //{ // EnableJSONP = true //}; //app.MapSignalR<EchoConnection>("/echo", config); //CORS config //app.Map("/echo", // map => // { // map.UseCors(CorsOptions.AllowAll); // map.RunSignalR<EchoConnection>(); // }); // 映射 hubs 默认为"/signalr" //app.MapSignalR(); var hubconfig = new HubConfiguration() { EnableJavaScriptProxies = true }; //映射Hubs到"/realtime",同时还可以配置HubConfiguration,比如我们uxyao跨域,和上一讲用法是一致 app.MapSignalR("/realtime", hubconfig); }
public void Configuration(IAppBuilder app) { //Configure AutoMapper (http://automapper.codeplex.com/) Mapper.Initialize(ConfigureMapper); //Configure Bearer Authentication OAuthOptions = new OAuthAuthorizationServerOptions(); app.UseOAuthBearerTokens(OAuthOptions); //Configure AutoFac for DependencyResolver (http://autofac.org/) IContainer container = RegisterServices(); var resolverForSignalr = new Autofac.Integration.SignalR.AutofacDependencyResolver(container); var resolver = new App.Common.AutoFacDependencyResolver(container); //Configure WebApi var config = new HttpConfiguration() { DependencyResolver = resolver }; ConfigureWebApi(config); app.UseWebApi(config); //Configure SignalR self host var hubConfiguration = new HubConfiguration() { Resolver = resolverForSignalr }; app.MapSignalR(hubConfiguration); //Log trafic using Log4Net app.Use(typeof(Logging)); // container.Resolve<IRavenRepository>(); //Set global dependency resolver for signalr GlobalHost.DependencyResolver = resolverForSignalr; }
public void Configuration(IAppBuilder app) { // Call our IoC static helper method to start the typical Autofac SignalR setup var container = IocConfig.RegisterDependencies(); // Get your HubConfiguration. In OWIN, we create one rather than using GlobalHost var hubConfig = new HubConfiguration(); // Sets the dependency resolver to be autofac. hubConfig.Resolver = new AutofacDependencyResolver(container); // OWIN SIGNALR SETUP: // Register the Autofac middleware FIRST, then the standard SignalR middleware. app.UseAutofacMiddleware(container); app.MapSignalR("/signalr", hubConfig); // There's not a lot of documentation or discussion for owin getting the hubcontext // Got this from here: https://stackoverflow.com/questions/29783898/owin-signalr-autofac var builder = new ContainerBuilder(); var connManager = hubConfig.Resolver.Resolve<IConnectionManager>(); builder.RegisterInstance(connManager) .As<IConnectionManager>() .SingleInstance(); builder.Update(container); container.Resolve<IBusControl>().Start(); }
public void Configuration(IAppBuilder app) { var container = ObjectFactory.Container; var resolver = new StructureMapSignalRDependencyResolver(container); ObjectFactory.Configure(x => { x.For<Microsoft.AspNet.SignalR.StockTicker.IStockTicker>() .Singleton() .Use<Microsoft.AspNet.SignalR.StockTicker.StockTicker>(); x.For<IHubConnectionContext>().ConditionallyUse(c => c.If(t => t.ParentType.GetInterface(typeof(Microsoft.AspNet.SignalR.StockTicker.IStockTicker).Name) == typeof(Microsoft.AspNet.SignalR.StockTicker.IStockTicker)) .ThenIt.Is.ConstructedBy( () => resolver.Resolve<IConnectionManager>().GetHubContext<StockTickerHub>().Clients) ); }); var config = new HubConfiguration() { Resolver = resolver }; //Set GlobalHost dependency resolver to ensure hubs utilize the same configuration (http://jerodkrone.com/signalr-2-0-dependency-injection-using-globalhost/). GlobalHost.DependencyResolver = resolver; //Required For iPad, without this the "Spinner" will spin infinitely (https://github.com/SignalR/SignalR/issues/1406). GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(1); GlobalHost.Configuration.LongPollDelay = TimeSpan.FromSeconds(5); Microsoft.AspNet.SignalR.StockTicker.Startup.ConfigureSignalR(app, config); }
public void Configuration(IAppBuilder app) { app.Map ( "/signalr", map => { map.UseCors(CorsOptions.AllowAll); var configuration = new HubConfiguration { EnableJavaScriptProxies = true }; map.RunSignalR(configuration); var module = new AuthorizeModule(null, null); GlobalHost.HubPipeline.AddModule(module); }); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new FrapidRazorViewEngine()); LogManager.InternalizeLogger(); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); AssetConfig.Register(); StartupRegistration.RegisterAsync().Wait(); BackupRegistration.Register(); EodTaskRegistration.Register(); AccountConfig.Register(app); }
public void Configuration(IAppBuilder appBuilder) { HttpConfiguration config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); FormatterConfig.ConfigureFormatters(config.Formatters); appBuilder.UseWebApi(config); var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; appBuilder.MapSignalR(hubConfiguration) .UseCors(CorsOptions.AllowAll); //appBuilder.Map("signalr", map => // { // // Setup the CORS middleware to run before SignalR. // // By default this will allow all origins. You can // // configure the set of origins and/or http verbs by // // providing a cors options with a different policy. // map.UseCors(CorsOptions.AllowAll); // var hubConfiguration = new HubConfiguration // { // // You can enable JSONP by uncommenting line below. // // JSONP requests are insecure but some older browsers (and some // // versions of IE) require JSONP to work cross domain // // EnableJSONP = true // }; // // Run the SignalR pipeline. We're not using MapSignalR // // since this branch already runs under the "/signalr" // // path. // map.RunSignalR(hubConfiguration); // }); }
public void Configuration(IAppBuilder app) { // Any connection or hub wire up and configuration should go here var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; app.MapSignalR(hubConfiguration); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); var config = new HubConfiguration(); //config.EnableJSONP = true; app.MapSignalR(config); }
public void Configuration(IAppBuilder app) { var configuration = new HubConfiguration(); configuration.EnableDetailedErrors = true; app.UseCors(CorsOptions.AllowAll); app.MapSignalR(configuration); }
public void Configuration(IAppBuilder app) { var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; app.MapSignalR(hubConfiguration); }
public void Configuration(IAppBuilder app) { //app.MapSignalR(); app.Map("/signalr", map => { map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { EnableJSONP = true }; map.RunSignalR(hubConfiguration); }); // Branch the pipeline here for requests that start with "/signalr" //app.Map("/signalr", map => //{ // // Setup the CORS middleware to run before SignalR. // // By default this will allow all origins. You can // // configure the set of origins and/or http verbs by // // providing a cors options with a different policy. // map.UseCors(CorsOptions.AllowAll); // var hubConfiguration = new HubConfiguration // { // // You can enable JSONP by uncommenting line below. // // JSONP requests are insecure but some older browsers (and some // // versions of IE) require JSONP to work cross domain // // EnableJSONP = true // }; // // Run the SignalR pipeline. We're not using MapSignalR // // since this branch already runs under the "/signalr" // // path. // map.RunSignalR(hubConfiguration); //}); }
public void Configuration(IAppBuilder app) { //FiddlerFriendly(GlobalHost.DependencyResolver); HubConfiguration hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; app.MapSignalR(hubConfiguration); }
public void Configuration(IAppBuilder app) { //log4net.Config.XmlConfigurator.Configure(); var bootstrapper = new Bootstrapper(); var container = bootstrapper.Build(); var priceFeed = container.Resolve<IPriceFeed>(); priceFeed.Start(); var cleaner = container.Resolve<Cleaner>(); cleaner.Start(); app.UseCors(CorsOptions.AllowAll); app.Map("/signalr", map => { var hubConfiguration = new HubConfiguration { // you don't want to use that in prod, just when debugging EnableDetailedErrors = true, EnableJSONP = true, Resolver = new AutofacSignalRDependencyResolver(container) }; map.UseCors(CorsOptions.AllowAll) .RunSignalR(hubConfiguration); }); }
public void Configuration(IAppBuilder app) { #region Global Configuration GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(110); GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(30); GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(10); GlobalHost.Configuration.DefaultMessageBufferSize = 500; #endregion #region Hub Configuration var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; hubConfiguration.EnableJavaScriptProxies = true; hubConfiguration.EnableJSONP = true; #endregion //var options = new CookieAuthenticationOptions() //{ // CookieName = "Token" //}; //app.UseCookieAuthentication(options); //app.Use<LoginMiddleware>(); app.MapSignalR("/signalr", hubConfiguration); }
public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 var hubConfiguration = new HubConfiguration { EnableDetailedErrors = true }; app.MapSignalR(hubConfiguration); }
public void Configuration(IAppBuilder app) { app.UseErrorPage(); app.Map("/raw-connection", map => { // Turns cors support on allowing everything // In real applications, the origins should be locked down map.UseCors(CorsOptions.AllowAll) .RunSignalR<RawConnection>(); }); app.Map("/signalr", map => { var config = new HubConfiguration { // You can enable JSONP by uncommenting this line // JSONP requests are insecure but some older browsers (and some // versions of IE) require JSONP to work cross domain // EnableJSONP = true }; // Turns cors support on allowing everything // In real applications, the origins should be locked down map.UseCors(CorsOptions.AllowAll) .RunSignalR(config); }); // Turn tracing on programmatically GlobalHost.TraceManager.Switch.Level = SourceLevels.All; }
public void Configuration(IAppBuilder app) { app.Map("/signalr", map => { app.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration { EnableJSONP = true }; /* GlobalHost.DependencyResolver.UseSqlServer( "Data Source=(local);"+ "Initial Catalog=SignalRChat;"+ "Integrated Security=True" ); GlobalHost.DependencyResolver.UseRedis( "localhost", 6379, "", "signalr.key"); GlobalHost.DependencyResolver.UseServiceBus( "your connection string from azure", "signalr"); */ map.RunSignalR(hubConfiguration); }); }
/// <summary> /// Cria o Hub de configuração do SignalR. /// </summary> /// <returns></returns> protected virtual HubConfiguration CreateHubConfiguration() { var dependencyResolver = new SignalR.DependencyResolver(); var hubConfiguration = new Microsoft.AspNet.SignalR.HubConfiguration { EnableJSONP = true, EnableJavaScriptProxies = true, EnableDetailedErrors = true, Resolver = dependencyResolver }; GlobalHost.DependencyResolver = dependencyResolver; return(hubConfiguration); }
public void Configuration(IAppBuilder app) { ///注册自定义的处理管道 GlobalHost.HubPipeline.AddModule(new SignalRs.NewHubPipelineModule()); // 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888 var config = new Microsoft.AspNet.SignalR.HubConfiguration(); config.EnableJSONP = true; config.EnableDetailedErrors = true; //使用自己的Hub文件夹 app.MapSignalR("/SignalRs", config); }