Skip to content

Commit

Permalink
Add .NET cases to workflow lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
edeNFed committed Dec 23, 2024
1 parent 5f3b442 commit c03f875
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System;

app.MapGet("/", () => "Hello World!");

app.Run("http://0.0.0.0:8080");
namespace LegacyWebHostTest
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
// Configure Kestrel, etc.
.UseKestrel()

// Logging
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
// Typically with 2.x hosting, AddConsole()
// sets up the console logger, including logger for WebHost
})

// Minimal pipeline
.Configure(app =>
{
app.Run(async context =>
{
var logger = context
.RequestServices
.GetService(typeof(ILogger<Program>))
as ILogger<Program>;

logger?.LogInformation("Handling request on path {path}", context.Request.Path);

await context.Response.WriteAsync("Hello from a legacy webhost on .NET 6\n");
});
})

// Build the host
.Build();

// Run
host.Run("http://0.0.0.0:8080");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition="'$(USE_DOTNET6)' == 'true'">net6.0</TargetFramework>
<TargetFramework Condition="'$(USE_DOTNET6)' != 'true'">net8.0</TargetFramework>
<RootNamespace>dotnet-musl-server</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down

0 comments on commit c03f875

Please sign in to comment.