当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.MapSignalR方法代码示例

本文整理汇总了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);
                }
            });
        }
开发者ID:GrowingData,项目名称:Mung,代码行数:27,代码来源:Startup.cs

示例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();
        }
开发者ID:baiyunping333,项目名称:BlazeDSP,代码行数:28,代码来源:Startup.SignalR.cs

示例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();
        }
开发者ID:nirmana,项目名称:SignalR,代码行数:34,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseCors(CorsOptions.AllowAll);
            ConfigureAuth(app);

            app.MapSignalR<AuthorizeEchoConnection>("/echo");
            app.MapSignalR();
        }
开发者ID:nedalco,项目名称:CookieAuthenticationSample,代码行数:8,代码来源:Startup.cs

示例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
        }
开发者ID:theberserker,项目名称:SignalRTestDrive,代码行数:9,代码来源:Startup.cs

示例6: Configuration

        public void Configuration(IAppBuilder app)
        {
            GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(60);

            app.MapSignalR<TestConnection>("/TestConnection");
            app.MapSignalR();

            Dashboard.Init();
        }
开发者ID:GaneshBachhao,项目名称:SignalR,代码行数:9,代码来源:Startup.cs

示例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);
 }
开发者ID:gruan01,项目名称:MessageCenter,代码行数:11,代码来源:TxtMsgSender.cs

示例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();
        }
开发者ID:KarsonAlford,项目名称:SignalR-2.x-demo,代码行数:12,代码来源:Startup.cs

示例9: Configuration

        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);

            
            app.MapSignalR<MyEndPoint>("/echo");
            app.MapSignalR<MyEndPoint2>("/echo2");
            app.MapSignalR<MyEndPointGroups>("/groups");

            app.MapSignalR();


        }
开发者ID:cesaroll,项目名称:SignalR_intro,代码行数:13,代码来源:Startup.cs

示例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();
     }
 }
开发者ID:danielharvell,项目名称:monitor-practice,代码行数:14,代码来源:Startup.cs

示例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);
        }
开发者ID:hanei0415,项目名称:SignalR.Client.Silverlight.License,代码行数:28,代码来源:Startup.cs

示例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 }
                );
        }
开发者ID:QuinntyneBrown,项目名称:SecurityApi,代码行数:34,代码来源:ApiConfiguration.cs

示例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);
        }
开发者ID:AlexanderUsmanov,项目名称:MyWebApp,代码行数:35,代码来源:Startup.Auth.cs

示例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);
 }
开发者ID:Abdullah2993,项目名称:Klepet,代码行数:7,代码来源:Startup.cs

示例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 }
                );
        }
开发者ID:QuinntyneBrown,项目名称:SavingsNearMe,代码行数:26,代码来源:ApiConfiguration.cs


注:本文中的IAppBuilder.MapSignalR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。