Update copyright year, improve documentation, upgrade to .NET 9.0, and refactor AspNetCore entry point.
This commit is contained in:
17
VAR.WebFormsCore.AspNetCore/DefaultMain.cs
Normal file
17
VAR.WebFormsCore.AspNetCore/DefaultMain.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using VAR.WebFormsCore.AspNetCore.Code;
|
||||
|
||||
namespace VAR.WebFormsCore.AspNetCore;
|
||||
|
||||
public static class DefaultMain
|
||||
{
|
||||
public static void WebFormCoreMain(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseGlobalRouterMiddleware(builder.Environment);
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace VAR.WebFormsCore.AspNetCore;
|
||||
|
||||
public static class DefaultMain
|
||||
{
|
||||
public static void WebFormCoreMain(string[] args) { CreateHostBuilder(args).Build().Run(); }
|
||||
|
||||
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using VAR.WebFormsCore.AspNetCore.Code;
|
||||
|
||||
namespace VAR.WebFormsCore.AspNetCore;
|
||||
|
||||
public class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// If using Kestrel:
|
||||
services.Configure<KestrelServerOptions>(options => { options.AddServerHeader = false; });
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseGlobalRouterMiddleware(env); }
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user