本文整理汇总了C#中IAppBuilder.MapSignalR方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.MapSignalR方法的具体用法?C# IAppBuilder.MapSignalR怎么用?C# IAppBuilder.MapSignalR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppBuilder
的用法示例。
在下文中一共展示了IAppBuilder.MapSignalR方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configuration
public void Configuration(IAppBuilder app)
{
app.MapSignalR<LogWriter>("/log/write");
app.MapSignalR<LogReader>("/log/read");
app.MapSignalR();
MungState.App.Pipeline.AddProcessor(new RelationalEventProcessor(PathManager.DataPath));
var metrics = new MetricFactory(PathManager.MetricPath, MungState.App.Pipeline);
metrics.Reload();
Task.Run(() => {
// If the app shut down without properly disposing of the file
// objects, we may have a whole lot of files still marked as "active"
// which are actually dead.
SqlBatchChecker.CleanUpOldFiles(PathManager.DataPath, Db.Warehouse);
});
Task.Run(() => {
while (true) {
Thread.Sleep(1000 * 60 );
SqlBatchChecker.Check(PathManager.DataPath, Db.Warehouse);
}
});
}
示例2: ConfigureSignalR
public static void ConfigureSignalR(IAppBuilder app)
{
// SignalR + Service Bus
var connectionString = CloudConfigurationManager.GetSetting(ServiceBusConnectionStrings.SignalRServiceBusConnection);
GlobalHost.DependencyResolver.UseServiceBus(connectionString, ServiceBusPathNames.SignalRServiceBus);
// Custom UserId provider
//GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => new UserIdProvider());
#if !DEBUG
// Minify hub javascript
GlobalHost.DependencyResolver.Register(typeof(IJavaScriptMinifier), () => new HubMinify());
#endif
// SignalR
#if DEBUG
app.MapSignalR(new HubConfiguration
{
EnableDetailedErrors = true
});
#else
app.MapSignalR(new HubConfiguration());
#endif
// Force Auth in SignalR
GlobalHost.HubPipeline.RequireAuthentication();
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
app.MapSignalR<SendingConnection>("/sending-connection");
app.MapSignalR<TestConnection>("/test-connection");
app.MapSignalR<RawConnection>("/raw-connection");
app.MapSignalR<StreamingConnection>("/streaming-connection");
app.Use(typeof(ClaimsMiddleware));
ConfigureSignalR(GlobalHost.DependencyResolver, GlobalHost.HubPipeline);
var config = new HubConfiguration()
{
EnableDetailedErrors = true
};
app.MapSignalR(config);
app.Map("/cors", map =>
{
map.UseCors(CorsOptions.AllowAll);
map.MapSignalR<RawConnection>("/raw-connection");
map.MapSignalR();
});
app.Map("/basicauth", map =>
{
map.UseBasicAuthentication(new BasicAuthenticationProvider());
map.MapSignalR<AuthenticatedEchoConnection>("/echo");
map.MapSignalR();
});
BackgroundThread.Start();
}
示例4: Configuration
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
ConfigureAuth(app);
app.MapSignalR<AuthorizeEchoConnection>("/echo");
app.MapSignalR();
}
示例5: Configuration
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
var hubConfig = new HubConfiguration() {EnableDetailedErrors = true};
app.MapSignalR(hubConfig); // the hub part registration (at /signalr)
app.MapSignalR<UsersConnection>("/echo"); // the persistent connection registration
}
示例6: Configuration
public void Configuration(IAppBuilder app)
{
GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(60);
app.MapSignalR<TestConnection>("/TestConnection");
app.MapSignalR();
Dashboard.Init();
}
示例7: Configuration
public void Configuration(IAppBuilder app)
{
GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => new UCUserIDProvider());
app.UseCors(CorsOptions.AllowAll);
var cfg = new HubConfiguration() {
EnableJSONP = true,
EnableDetailedErrors = true
};
app.MapSignalR("/Msg", cfg);
app.MapSignalR(cfg);
}
示例8: Configuration
public void Configuration(IAppBuilder app)
{
GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => new QueryStringUserIdProvider());
app.MapSignalR<JavaScriptSendObjects.Connection>("/JavaScriptSendObjects/connection");
app.MapSignalR<JavaScriptErrorHandling.Connection>("/JavaScriptErrorHandling/connection");
app.MapSignalR<JavaScriptCustomJsonParsing.Connection>("/JavaScriptCustomJsonParsing/connection");
app.MapSignalR<SendPreEncodedJson.Connection>("/SendPreEncodedJson/connection");
app.MapSignalR();
//app.MapSignalRWithCors();
}
示例9: Configuration
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
app.MapSignalR<MyEndPoint>("/echo");
app.MapSignalR<MyEndPoint2>("/echo2");
app.MapSignalR<MyEndPointGroups>("/groups");
app.MapSignalR();
}
示例10: Configuration
public void Configuration(IAppBuilder app)
{
if (Debugger.IsAttached)
{
var hubConfiguration = new HubConfiguration();
hubConfiguration.EnableDetailedErrors = true;
hubConfiguration.EnableJavaScriptProxies = true;
app.MapSignalR("/visualcronmonitor/signalr", hubConfiguration);
}
else
{
app.MapSignalR();
}
}
示例11: 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);
}
示例12: Install
public static new void Install(HttpConfiguration config, IAppBuilder app)
{
config.SuppressHostPrincipal();
SecurityApi.Services.Contracts.IIdentityService identityService = UnityConfiguration.GetContainer().Resolve<SecurityApi.Services.Contracts.IIdentityService>();
app.UseOAuthAuthorizationServer(new OAuthOptions(identityService));
app.UseJwtBearerAuthentication(new SecurityApi.Auth.JwtOptions());
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
var jSettings = new JsonSerializerSettings();
jSettings.Formatting = Formatting.Indented;
jSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.Formatters.JsonFormatter.SerializerSettings = jSettings;
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
示例13: ConfigureAuth
// Дополнительные сведения о настройке проверки подлинности см. по адресу: http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.MapSignalR();
// Настройка контекста базы данных, диспетчера пользователей и диспетчера входа для использования одного экземпляра на запрос
app.CreatePerOwinContext(DAL.ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
// Включение использования файла cookie, в котором приложение может хранить информацию для пользователя, выполнившего вход,
// и использование файла cookie для временного хранения информации о входах пользователя с помощью стороннего поставщика входа
// Настройка файла cookie для входа
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Позволяет приложению проверять метку безопасности при входе пользователя.
// Эта функция безопасности используется, когда вы меняете пароль или добавляете внешнее имя входа в свою учетную запись.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Позволяет приложению временно хранить информацию о пользователе, пока проверяется второй фактор двухфакторной проверки подлинности.
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
// Позволяет приложению запомнить второй фактор проверки имени входа. Например, это может быть телефон или почта.
// Если выбрать этот параметр, то на устройстве, с помощью которого вы входите, будет сохранен второй шаг проверки при входе.
// Точно так же действует параметр RememberMe при входе.
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
}
示例14: Configuration
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(110);
GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(10);
GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(2);
}
示例15: Install
public static new void Install(HttpConfiguration config, IAppBuilder app)
{
config.SuppressHostPrincipal();
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
var jSettings = new JsonSerializerSettings();
jSettings.Formatting = Formatting.Indented;
jSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.Formatters.JsonFormatter.SerializerSettings = jSettings;
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}