本文整理汇总了C#中IApplicationBuilder.ConfigureRoutes方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.ConfigureRoutes方法的具体用法?C# IApplicationBuilder.ConfigureRoutes怎么用?C# IApplicationBuilder.ConfigureRoutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationBuilder
的用法示例。
在下文中一共展示了IApplicationBuilder.ConfigureRoutes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Add static files to the request pipeline
app.UseStaticFiles();
// Add cookie-based authentication to the request pipeline
app.UseIdentity();
// Add the following to the request pipeline only in development environment.
if (env.IsEnvironment("Development"))
{
app.UseBrowserLink();
}
/* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
* Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
*/
app.UseErrorPage(ErrorPageOptions.ShowAll);
app.ConfigureSecurity();
//Configure SignalR
app.UseSignalR();
// Add MVC to the request pipeline
app.ConfigureRoutes();
MyShuttleDataInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例2: Configure
public void Configure(IApplicationBuilder app)
{
// Setup configuration sources
var configuration = new Configuration();
configuration.AddJsonFile("config.json");
configuration.AddEnvironmentVariables();
// Set up application services
app.UseServices(services =>
{
// Add EF services to the services container and configure DbContext
services.ConfigureDataContext(configuration);
// Register MyShuttle dependencies
services.ConfigureDependencies();
//Add Identity services to the services container
services.AddDefaultIdentity<MyShuttleContext, ApplicationUser, IdentityRole>(configuration);
services.ConfigureCookieAuthentication(options =>
{
options.LoginPath = new Microsoft.AspNet.Http.PathString("/Carrier/Login");
});
// Add MVC services to the services container
services.AddMvc();
services
.AddSignalR(options =>
{
options.Hubs.EnableDetailedErrors = true;
});
});
// Enable Browser Link support
app.UseBrowserLink();
/* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
* Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
*/
app.UseErrorPage(ErrorPageOptions.ShowAll);
// Add static files to the request pipeline
app.UseStaticFiles();
app.ConfigureSecurity();
//Configure SignalR
app.UseSignalR();
// Add cookie-based authentication to the request pipeline
// Add MVC to the request pipeline
app.ConfigureRoutes();
MyShuttleDataInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例3: Configure
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
app.UseStaticFiles();
//app.UseIdentity();
app.ConfigureRoutes();
MyShuttleDataInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例4: Configure
// Configure is called after ConfigureServices is called.
public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, MyHealthDataInitializer dataInitializer)
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
loggerFactory.AddDebug();
// Configure the HTTP request pipeline.
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(options => options.EnableAll());
}
else
{
// Add Error handling middleware which catches all application specific errors and
// sends the request to the following path or controller action.
app.UseExceptionHandler("/Home/Error");
}
// Add the platform handler to the request pipeline.
app.UseIISPlatformHandler();
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.ConfigureRoutes();
await dataInitializer.InitializeDatabaseAsync(app.ApplicationServices, Configuration);
}
示例5: Configure
// Configure is called after ConfigureServices is called.
public async void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFactory loggerFactory, MyHealthDataInitializer dataInitializer)
{
// Add Application Insights monitoring to the request pipeline as a very first middleware.
app.UseApplicationInsightsRequestTelemetry();
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(options => options.EnableAll());
}
else
{
app.UseExceptionHandler("/Home/Error");
}
// Add Application Insights exceptions handling to the request pipeline.
app.UseApplicationInsightsExceptionTelemetry();
// Add static files to the request pipeline.
app.UseStaticFiles();
app.UseSession();
app.ConfigureSecurity();
// Add MVC to the request pipeline.
app.ConfigureRoutes();
app.UseIISPlatformHandler();
await dataInitializer.InitializeDatabaseAsync(app.ApplicationServices);
}
示例6: Configure
public void Configure(IApplicationBuilder app)
{
app.ConfigureRoutes();
app.UseStaticFiles();
MyShuttleDataInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}