本文整理汇总了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();
}
示例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>");
});
}
示例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?}");
});
}
示例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!");
});
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例10: ConfigureDevelopment
public void ConfigureDevelopment(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(minLevel: LogLevel.Verbose);
loggerFactory.AddDebug();
app.UseDeveloperExceptionPage();
app.UseRuntimeInfoPage();
Configure(app, loggerFactory);
}
示例11: ConfigureApplication
public void ConfigureApplication(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseMvc();
app.UseRuntimeInfoPage();
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
示例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);
});
}
示例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!");
//});
}
示例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);
}
示例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);
});
}