| 313 | public class HttpServerSample |
| 314 | { |
| 315 | public void Run(CancellationToken cancellationToken) |
| 316 | { |
| 317 | var config = new ConfigurationBuilder() |
| 318 | .AddEnvironmentVariables(prefix: "ASPNETCORE_") |
| 319 | .Build(); |
| 320 | |
| 321 | var host = new HostBuilder(). |
| 322 | ConfigureWebHost(webhostbuilder => { |
| 323 | webhostbuilder.UseConfiguration(config) |
| 324 | .UseUrls("http://localhost:9090") |
| 325 | .UseContentRoot(Directory.GetCurrentDirectory()) |
| 326 | .UseStartup<Startup>() |
| 327 | .UseKestrel() |
| 328 | .ConfigureLogging((ctx, logging) => LoggingHelper.ConfigureLogging(logging)) |
| 329 | ; |
| 330 | }) |
| 331 | .Build(); |
| 332 | |
| 333 | Logger.LogTrace("test"); |
| 334 | Logger.LogCritical("test"); |
| 335 | host.RunAsync(cancellationToken).GetAwaiter().GetResult(); |
| 336 | } |
| 337 | |
| 338 | public class Startup |
| 339 | { |