本文整理汇总了C#中Microsoft.AspNet.SignalR.HubConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# HubConfiguration类的具体用法?C# HubConfiguration怎么用?C# HubConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HubConfiguration类属于Microsoft.AspNet.SignalR命名空间,在下文中一共展示了HubConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Configuration
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);
});
}
开发者ID:sergeu90,项目名称:OurMemory,代码行数:33,代码来源:Startup.cs
示例2: Configuration
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);
}
开发者ID:hanei0415,项目名称:SignalR.Client.Silverlight.License,代码行数:28,代码来源:Startup.cs
示例3: Configuration
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);
});
}
开发者ID:dancingchrissit,项目名称:ReactiveTrader,代码行数:26,代码来源:Startup.cs
示例4: Configuration
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);
}
开发者ID:shayananique,项目名称:SignalRServer,代码行数:7,代码来源:Program.cs
示例5: Configuration
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;
}
开发者ID:batrashish,项目名称:signalr-qt,代码行数:31,代码来源:Startup.cs
示例6: Configuration
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);
});
}
开发者ID:Jurabek,项目名称:SignalrRxDemo,代码行数:29,代码来源:Startup.cs
示例7: Configure
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;
}
开发者ID:MrAntix,项目名称:sandbox-hit-me,代码行数:28,代码来源:SignalRConfiguration.cs
示例8: Configuration
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;
}
开发者ID:andreyskv,项目名称:chessrock,代码行数:31,代码来源:Startup.cs
示例9: Configuration
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);
}
开发者ID:jerodkrone,项目名称:SignalRStructureMapWalkthrough,代码行数:34,代码来源:SignalRStartup.cs
示例10: Configuration
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);
});
}
开发者ID:RenYueHD,项目名称:SignalRExtendLib,代码行数:26,代码来源:Startup.cs
示例11: Configuration
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);
}
开发者ID:thnk2wn,项目名称:OwinAccessDeniedOnStartup,代码行数:26,代码来源:WebAppStartup.cs
示例12: Configuration
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);
}
开发者ID:WorkMarketingNet,项目名称:WMN.Edge,代码行数:34,代码来源:Startup.cs
示例13: Configuration
public void Configuration(IAppBuilder app)
{
var configuration = new HubConfiguration();
configuration.EnableDetailedErrors = true;
configuration.Resolver = new SignalRDependencyResolver();
app.MapSignalR(configuration);
}
开发者ID:olegta,项目名称:UmlDiagrams,代码行数:7,代码来源:Startup.cs
示例14: Configure
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;
});
});
}
开发者ID:swanitzek,项目名称:ASP5-MVC6-SignalR2,代码行数:28,代码来源:Startup.cs
示例15: Configuration
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);
}
开发者ID:electricneuron,项目名称:jonel.communicationservice,代码行数:7,代码来源:SignalRStartup.cs
示例16: Configuration
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);
// });
}
开发者ID:bnayae,项目名称:SDP-2015,代码行数:34,代码来源:Startup.cs
示例17: Configuration
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);
}
开发者ID:frapid,项目名称:frapid,代码行数:33,代码来源:Startup.cs
示例18: Configuration
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
var config = new HubConfiguration();
//config.EnableJSONP = true;
app.MapSignalR(config);
}
开发者ID:PascalS86,项目名称:Group3Demo,代码行数:7,代码来源:Startup.cs
示例19: Configuration
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);
}
开发者ID:provenstyle,项目名称:SignalRChat,代码行数:7,代码来源:Startup.cs
示例20: Configuration
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);
}
开发者ID:AndreasFurster,项目名称:kiwi,代码行数:29,代码来源:Startup.cs
注:本文中的Microsoft.AspNet.SignalR.HubConfiguration类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论