58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Hosting.Server;
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace ServerComparison.TestSites
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var config = new ConfigurationBuilder()
|
|
.AddCommandLine(args)
|
|
.Build();
|
|
|
|
var builder = new WebHostBuilder()
|
|
.UseServer(new NoopServer())
|
|
.UseConfiguration(config)
|
|
.ConfigureLogging((_, factory) =>
|
|
{
|
|
factory.AddConsole();
|
|
factory.AddFilter("Console", level => level >= LogLevel.Warning);
|
|
})
|
|
.UseStartup("Microsoft.AspNetCore.Hosting.TestSites");
|
|
|
|
var host = builder.Build();
|
|
|
|
host.Run();
|
|
}
|
|
}
|
|
|
|
public class NoopServer : IServer
|
|
{
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
public IFeatureCollection Features { get; } = new FeatureCollection();
|
|
|
|
public Task StartAsync<TContext>(IHttpApplication<TContext> application, CancellationToken cancellationToken)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|
|
|