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


C# IApplicationBuilder.UseGlimpse方法代码示例

本文整理汇总了C#中IApplicationBuilder.UseGlimpse方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseGlimpse方法的具体用法?C# IApplicationBuilder.UseGlimpse怎么用?C# IApplicationBuilder.UseGlimpse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IApplicationBuilder的用法示例。


在下文中一共展示了IApplicationBuilder.UseGlimpse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            app.UseGlimpse();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIISPlatformHandler();

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                // 404 routingfor SPA
                routes.MapRoute("spa-fallback", "{*anything}", new { controller = "Home", action = "Index" });

            });
        }
开发者ID:isurufonseka,项目名称:cleanshave,代码行数:30,代码来源:Startup.cs

示例2: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, 
                              IHostingEnvironment env, 
                              ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIISPlatformHandler(options => 
                                      options.AuthenticationDescriptions.Clear());
            app.UseStaticFiles();
            app.UseGlimpse();

            app.UseMvc(routes =>
            {
                routes.MapRoute("default", 
                                "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute("spa-fallback", 
                                "{*anything}", 
                                new { controller = "Home", action = "Index" });
                routes.MapWebApiRoute("defaultApi", 
                                      "api/{controller}/{id?}");
            });
        }
开发者ID:IEvangelist,项目名称:MvcAngular2,代码行数:34,代码来源:Startup.cs

示例3: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseGlimpse();

            // TODO: Nedd to find a better way of registering this. Problem is that this
            //       registration is aspnet5 specific.
            app.UseSignalR("/Glimpse/Data/Stream");

            app.UseWelcomePage();
        }
开发者ID:rndthoughts,项目名称:Glimpse.Prototype,代码行数:10,代码来源:Startup.cs

示例4: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseGlimpse();

            app.Use(next => new SamplePage().Invoke);
            /*
            app.Use(async (context, next) => {
                        var response = context.Response;

                        response.Headers.Set("Content-Type", "text/plain");

                        await response.WriteAsync("TEST!");
                    });
            */
            app.UseWelcomePage();

        }
开发者ID:mike-kaufman,项目名称:Glimpse.Prototype,代码行数:17,代码来源:Startup.cs

示例5: ConfigureDebugging

        /// <summary>
        /// Configure tools used to help with debugging the application.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="environment">The environment the application is running under. This can be Development, 
        /// Staging or Production by default.</param>
        private static void ConfigureDebugging(
            IApplicationBuilder application,
            IHostingEnvironment environment)
        {
            // Add the following to the request pipeline only in development environment.
            if (environment.IsDevelopment())
            {
                // Browse to /runtimeinfo to see information about the runtime that is being used and the packages that 
                // are included in the application. See http://docs.asp.net/en/latest/fundamentals/diagnostics.html
                application.UseRuntimeInfoPage();

                // Allow updates to your files in Visual Studio to be shown in the browser. You can use the Refresh 
                // browser link button in the Visual Studio toolbar or Ctrl+Alt+Enter to refresh the browser.
                application.UseBrowserLink();

                // Add Glimpse to help with debugging (See http://getglimpse.com/).
                application.UseGlimpse();
            }
        }
开发者ID:Pro-Coded,项目名称:Pro.MVCMagic,代码行数:25,代码来源:Startup.Debugging.cs

示例6: Configure

        // Configure is called after ConfigureServices is called.
        // you can change this method signature to include any dependencies that need to be injected into this method
        // you can see we added the dependency for IOptions<MultiTenantOptions>
        // so basically if you need any service in this method that was previously setup in ConfigureServices
        // you can just add it to the method signature and it will be provided by dependency injection
        public void Configure(
            IApplicationBuilder app, 
            IHostingEnvironment env, 
            ILoggerFactory loggerFactory,
            IOptions<MultiTenantOptions> multiTenantOptions,
            IServiceProvider serviceProvider,
            ILogRepository logRepository)
        {
            // Configure the HTTP request pipeline.

            //http://blog.getglimpse.com/2015/11/19/installing-glimpse-v2-beta1/
            bool enableGlimpse = Configuration.Get<bool>("DiagnosticOptions:EnableGlimpse", false);
            if(enableGlimpse)
            {
                app.UseGlimpse();
            }


            // LogLevels
            //Debug = 1,
            //Trace = 2,
            //Information = 3,
            //Warning = 4,
            //Error = 5,
            //Critical = 6,
            
            // Add the console logger.
            loggerFactory.AddConsole(minLevel: LogLevel.Warning);
            
            // a customizable filter for logging
            LogLevel minimumLevel = LogLevel.Warning;
            List<string> excludedLoggers = new List<string>();
            // add exclusions to remove noise in the logs

            // we need to filter out EF otherwise each time we persist a log item to the db more logs are generated
            // so it can become an infinite loop that keeps creating data
            // you can add any loggers that you want to exclude to reduce noise in the log
            excludedLoggers.Add("Microsoft.Data.Entity.Storage.Internal.RelationalCommandBuilderFactory");
            excludedLoggers.Add("Microsoft.Data.Entity.Query.Internal.QueryCompiler");
            excludedLoggers.Add("Microsoft.Data.Entity.DbContext");

            Func<string, LogLevel, bool> logFilter = delegate (string loggerName, LogLevel logLevel)
            {
                if (logLevel < minimumLevel) { return false; }
                if(excludedLoggers.Contains(loggerName)) { return false; }

                return true;
            };
            // Add cloudscribe db logging
            loggerFactory.AddDbLogger(serviceProvider, logRepository, logFilter);
            


            //app.UseCultureReplacer();

            // localization from .resx files is not really working in beta8
            // will have to wait till next release

            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("it"),
                new CultureInfo("fr-FR")
            };

            var locOptions = new RequestLocalizationOptions
            {
                // You must explicitly state which cultures your application supports.
                // These are the cultures the app supports for formatting numbers, dates, etc.
                SupportedCultures = supportedCultures,
                SupportedUICultures = supportedCultures

            };
            // You can change which providers are configured to determine the culture for requests, or even add a custom
            // provider with your own logic. The providers will be asked in order to provide a culture for each request,
            // and the first to provide a non-null result that is in the configured supported cultures list will be used.
            // By default, the following built-in providers are configured:
            // - QueryStringRequestCultureProvider, sets culture via "culture" and "ui-culture" query string values, useful for testing
            // - CookieRequestCultureProvider, sets culture via "ASPNET_CULTURE" cookie
            // - AcceptLanguageHeaderRequestCultureProvider, sets culture via the "Accept-Language" request header
            //locOptions.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context =>
            //{
            //  // My custom request culture logic
            //  return new ProviderCultureResult("en");
            //}));
            //app.UseRequestLocalization(locOptions, 
            //    defaultRequestCulture: new RequestCulture(culture: "en-US", uiCulture: "en-US"));

            
            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                //app.UseBrowserLink();

                app.UseDeveloperExceptionPage();
//.........这里部分代码省略.........
开发者ID:lespera,项目名称:cloudscribe,代码行数:101,代码来源:Startup.cs

示例7: Configure

        //This method is invoked when ASPNET_ENV is 'Development' or is not defined
        //The allowed values are Development,Staging and Production
        //public void ConfigureDevelopment(IApplicationBuilder app, ILoggerFactory loggerFactory)
        //{
        //    loggerFactory.AddConsole(minLevel: LogLevel.Warning);

        //Helps with auto page reloading and intergration with VS
        //app.UseBrowserLink();
        //        //Get useful information for exceptions
        //        app.UseDeveloperExceptionPage();
        //        //Displays database related error details
        //        app.UseDatabaseErrorPage();
        //        // Add the runtime information page that can be used by developers
        //        // to see what packages are used by the application
        //        // default path is: /runtimeinfo
        //        app.UseRuntimeInfoPage();

        //    Configure(app);
        //}
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug(LogLevel.Information);
            app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
            //app.UseMiddleware<FeelTheForceMiddleware>();
            app.UseFeelTheForce();
            if (env.IsDevelopment())
            {
                //Helps with auto page reloading and intergration with VS
                app.UseBrowserLink();
                //Get useful information for exceptions
                app.UseDeveloperExceptionPage();
                //Displays database related error details
                app.UseDatabaseErrorPage();
                // Add the runtime information page that can be used by developers
                // to see what packages are used by the application
                // default path is: /runtimeinfo
                app.UseRuntimeInfoPage();
            }
            else
            {
                //Where to go when we get an Exception
                app.UseExceptionHandler("/Home/Error");

                // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859
                try
                {
                    using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
                        .CreateScope())
                    {
                        serviceScope.ServiceProvider.GetService<ApplicationDbContext>().Database.Migrate();
                    }
                }
                catch { }
            }


            var useGlimpse = Configuration.Get<bool>("Glimpse:Enabled");
            if (useGlimpse)
            {
                app.UseGlimpse();
            }

            //Alllow hosting static files
            app.UseStaticFiles();

            //Enabled Asp.Net Identity
            app.UseIdentity();

            //// To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715
            //app.UseCors(a => a.AllowAnyOrigin());
            //Setup routing
            app.UseMvc(routes =>
            {

                routes.UseTypedRouting();
                routes.MapRoute(
      name: "default",
      template: "{controller=Home}/{action=About}/{id?}");
            });
        }
开发者ID:freemsly,项目名称:MVC6-Awakens,代码行数:82,代码来源:Startup.cs


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