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


C# IApplicationBuilder.UseRuntimeInfoPage方法代码示例

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


在下文中一共展示了IApplicationBuilder.UseRuntimeInfoPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
        {
            // Use different settings depending on debug or production builds
            if (env.IsDevelopment())
            {
                // Register the Microsoft default Error Handler
                app.UseDeveloperExceptionPage();

                // Register the ASP.NET Runtime Info Page
                app.UseRuntimeInfoPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            
            // Shows an error page when there is a 400 - 599 error
            app.UseStatusCodePagesWithRedirects("/Home/Error");

            // Register MVC Middleware AND specify the routing format
            app.UseMvc(routes => routes.MapRoute("Default", "{controller=Home}/{action=Index}/{id?}"));

            // Register the File Server Middleware
            app.UseFileServer();
        }
开发者ID:Pycorax,项目名称:SP4Unity,代码行数:26,代码来源:Startup.cs

示例2: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (string.Equals(env.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase))
            {
                app.UseDeveloperExceptionPage();

                app.UseRuntimeInfoPage(); // default path is /runtimeinfo
            }
            else
            {
                // specify production behavior for error handling, for example:
                // app.UseExceptionHandler("/Home/Error");
                // if nothing is set here, exception will not be handled.
            }

            app.UseWelcomePage("/welcome");

            app.Run(async (context) =>
            {
                if(context.Request.Query.ContainsKey("throw")) throw new Exception("Exception triggered!");
                context.Response.ContentType = "text/html";
                await context.Response.WriteAsync("<html><body>Hello World!");
                await context.Response.WriteAsync("<ul>");
                await context.Response.WriteAsync("<li><a href=\"/welcome\">Welcome Page</a></li>");
                await context.Response.WriteAsync("<li><a href=\"/?throw=true\">Throw Exception</a></li>");
                await context.Response.WriteAsync("</ul>");
                await context.Response.WriteAsync("</body></html>");
            });
        }
开发者ID:dvincent,项目名称:Docs,代码行数:29,代码来源:Startup.cs

示例3: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory)
        {
            // Configure the HTTP request pipeline.

            // Add the console logger.
            loggerfactory.AddConsole();

            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                app.UseBrowserLink();
                app.UseErrorPage();
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // send the request to the following path or controller action.
                app.UseErrorHandler("/Home/Error");
            }

            app.UseRuntimeInfoPage();
            // Add static files to the request pipeline.
            app.UseStaticFiles();

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

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            });
        }
开发者ID:johnciliberti,项目名称:MVC6Recipes,代码行数:36,代码来源:Startup.cs

示例4: Configure

        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseErrorHandler(a =>
            {
                a.UseMiddleware<ErrorMiddleware>();
            });

            app.UseWelcomePage("/welcome");
            app.UseRuntimeInfoPage("/runtimeinfo");


            //app.UseErrorPage();


            app.Run(async (context) =>
            {
                if (context.Request.Query.ContainsKey("throw"))
                    throw new AggregateException("Some funny exception, 42");

                await context.Response.WriteAsync("Hello World!");
            });            
        }
开发者ID:rafsan,项目名称:Cancel,代码行数:28,代码来源:Startup.cs

示例5: Configure

        public void Configure(IApplicationBuilder app)
        {
            var password = config["password"];

            if (config.Get<bool>("RecreateDatabase"))
            {
                var context = app.ApplicationServices.GetService<Models.BlogDataContext>();
                context.Database.EnsureDeleted();
                System.Threading.Thread.Sleep(2000);
                context.Database.EnsureCreated();
            }

            app.UseIdentity();

            if (config.Get<bool>("debug"))
            {
                app.UseDeveloperExceptionPage();
                app.UseRuntimeInfoPage();
            }
            else
            {
                app.UseExceptionHandler("/home/error");
            }

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

            app.UseFileServer();
        }
开发者ID:lukehammer,项目名称:UpAndRunningWithAspNet5,代码行数:29,代码来源:Startup.cs

示例6: Configure

        public void Configure(IApplicationBuilder app)
        {
            var config = new Configuration();
            config.AddEnvironmentVariables();
            config.AddJsonFile("config.json");
            config.AddJsonFile("config.dev.json", true);
            config.AddUserSecrets();

            var password = config.Get("password");

            if (config.Get<bool>("RecreateDatabase"))
            {
                var context = app.ApplicationServices.GetService<Models.BlogDataContext>();
                context.Database.EnsureDeleted();
                System.Threading.Thread.Sleep(2000);
                context.Database.EnsureCreated();
            }


            if (config.Get<bool>("debug"))
            {
                app.UseErrorPage();
                app.UseRuntimeInfoPage();
            }
            else
            {
                app.UseErrorHandler("/home/error");
            }

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

            app.UseFileServer();
        }
开发者ID:lukehammer,项目名称:AspNetBlog,代码行数:34,代码来源:Startup.cs

示例7: 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)
        {
            // Configuration
            var builder = new ConfigurationBuilder()
                .AddJsonFile("appsettings.json")
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            builder.AddEnvironmentVariables();
            builder.Build();

            // Logging
            loggerFactory.AddDebug(minLevel: LogLevel.Verbose);
            
            // Using different environments
            if (string.Equals(env.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase)) { }

            // Middlewares
            app.UseDeveloperExceptionPage();
            app.UseRuntimeInfoPage(); // default path is /runtimeinfo            
            app.UseDefaultFiles();
            app.UseStaticFiles();

            // Web sockets
            app.Map("/Managed", (appBuilder) => WebSocketsHelper.Configure(appBuilder, loggerFactory));

            // IIS
            app.UseIISPlatformHandler();
        }
开发者ID:streamcode9,项目名称:chat,代码行数:29,代码来源:Startup.cs

示例8: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {

            app.UseIISPlatformHandler();
            app.UseStaticFiles();
            if(env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseRuntimeInfoPage("/rti");
            } else
            {

            }
            app.UseMvc(route =>
            {
                route.MapRoute(
                    name: "default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new {controller="recipe", action="index"}
                    );
            });
            SampleData.Initialize(app.ApplicationServices);
        }
开发者ID:KrInMotion,项目名称:RecipeManager,代码行数:25,代码来源:Startup.cs

示例9: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, WorldContextSeedData seeder, ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                loggerFactory.AddDebug(LogLevel.Warning);

                app.UseDeveloperExceptionPage();

                app.UseDatabaseErrorPage(options =>
                {
                    options.EnableAll();
                });

                app.UseRuntimeInfoPage(); // default path is /runtimeinfo
            }
            else
            {
                // specify production behavior for error handling, for example:
                // app.UseExceptionHandler("/Home/Error");
                // if nothing is set here, exception will not be handled.
            }

            app.UseStaticFiles();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", action = "Index" }
                );
            });

            seeder.EnsureSeedData();
        }
开发者ID:MikeyUchiha,项目名称:TheWorld,代码行数:36,代码来源:Startup.cs

示例10: ConfigureDevelopment

 public void ConfigureDevelopment(IApplicationBuilder app, ILoggerFactory loggerFactory)
 {
     loggerFactory.AddConsole(minLevel: LogLevel.Verbose);
     loggerFactory.AddDebug();
     app.UseDeveloperExceptionPage();
     app.UseRuntimeInfoPage();
     Configure(app, loggerFactory);
 }
开发者ID:jruckert,项目名称:ignitedemo2015,代码行数:8,代码来源:Startup.cs

示例11: ConfigureApplication

        public void ConfigureApplication(IApplicationBuilder app)
        {
            app.UseStaticFiles();

            app.UseMvc();

            app.UseRuntimeInfoPage();
            app.UseBrowserLink();
            app.UseDeveloperExceptionPage();
            app.UseDatabaseErrorPage();
        }
开发者ID:MarkGravestock,项目名称:ReadingListApi,代码行数:11,代码来源:Startup.cs

示例12: Configure

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

            app.Run(context =>
            {
                context.Response.StatusCode = 302;
                context.Response.Headers["Location"] = "/runtimeinfo";

                return Task.FromResult(0);
            });
        }
开发者ID:leloulight,项目名称:Diagnostics,代码行数:12,代码来源:Startup.cs

示例13: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            app.UseRuntimeInfoPage("/info");

            app.UseWelcomePage();

            //app.UseMvc();

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
开发者ID:ToonDC,项目名称:aspnetdemo,代码行数:14,代码来源:Startup.cs

示例14: ConfigureDevelopment

        public void ConfigureDevelopment(IApplicationBuilder app, IOptions<AppSettings> settings,
            IHostingEnvironment env, ILoggerFactory loggerfactory)
        {
            loggerfactory.AddConsole(minLevel: LogLevel.Warning);

            app.UseDeveloperExceptionPage();

            app.UseDatabaseErrorPage();

            app.UseRuntimeInfoPage();

            Configure(app);
        }
开发者ID:mikeandersun,项目名称:experimental,代码行数:13,代码来源:Startup.cs

示例15: Configure

 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeter greeter)
 {
     app.UseRuntimeInfoPage("/info");
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     app.UseFileServer();
     app.UseMvc(ConfigureRoutes);
     app.Run(async (context) =>
     {
         var greeting = greeter.GetGreeting();
         await context.Response.WriteAsync(greeting);
     });
 }
开发者ID:Chitach,项目名称:OdeToFood,代码行数:16,代码来源:Startup.cs


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