-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .NET cases to workflow lifecycle
- Loading branch information
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
52 changes: 48 additions & 4 deletions
52
tests/e2e/workload-lifecycle/services/dotnet-musl-server/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
tests/e2e/workload-lifecycle/services/dotnet-musl-server/dotnet-musl-server.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters