33 lines
811 B
C#
33 lines
811 B
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace StartupFilterSample
|
|
{
|
|
public class Startup
|
|
{
|
|
#region snippet1
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddTransient<IStartupFilter, RequestSetOptionsStartupFilter>();
|
|
services.AddMvc();
|
|
}
|
|
#endregion
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
else
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
}
|
|
|
|
app.UseStaticFiles();
|
|
app.UseMvc();
|
|
}
|
|
}
|
|
}
|