Ooui-tws-port/PlatformSamples/AspNetCoreMvc/Startup.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2017-11-10 02:54:50 +00:00
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
2021-05-09 18:27:13 +00:00
using Microsoft.Extensions.Hosting;
2017-11-10 02:54:50 +00:00
namespace AspNetCoreMvc
{
public class Startup
{
2017-11-10 05:00:15 +00:00
public Startup (IConfiguration configuration)
2017-11-10 02:54:50 +00:00
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
2017-11-10 05:00:15 +00:00
public void ConfigureServices (IServiceCollection services)
2017-11-10 02:54:50 +00:00
{
2021-05-09 18:27:13 +00:00
services.AddControllersWithViews ();
2017-11-10 02:54:50 +00:00
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
2021-05-09 18:27:13 +00:00
public void Configure (IApplicationBuilder app, IWebHostEnvironment env)
2017-11-10 02:54:50 +00:00
{
2017-11-10 05:00:15 +00:00
if (env.IsDevelopment ()) {
app.UseDeveloperExceptionPage ();
2017-11-10 02:54:50 +00:00
}
2017-11-10 05:00:15 +00:00
else {
app.UseExceptionHandler ("/Home/Error");
2021-05-09 18:27:13 +00:00
app.UseHsts ();
2017-11-10 02:54:50 +00:00
}
2021-05-09 18:27:13 +00:00
//app.UseHttpsRedirection ();
2017-11-10 05:00:15 +00:00
app.UseStaticFiles ();
2017-11-10 02:54:50 +00:00
2021-05-09 18:27:13 +00:00
app.UseRouting ();
2017-11-10 05:00:15 +00:00
app.UseOoui ();
2017-11-10 17:57:45 +00:00
Xamarin.Forms.Forms.Init ();
2021-05-09 18:27:13 +00:00
app.UseEndpoints (endpoints => {
endpoints.MapControllerRoute (
2017-11-10 02:54:50 +00:00
name: "default",
2021-05-09 18:27:13 +00:00
pattern: "{controller=Home}/{action=Index}/{id?}");
2017-11-10 02:54:50 +00:00
});
}
}
}