2 implementations of IWebHost
Microsoft.AspNetCore.Hosting (1)
Internal\WebHost.cs (1)
22internal sealed partial class WebHost : IWebHost, IAsyncDisposable
Microsoft.AspNetCore.Hosting.Tests (1)
Fakes\GenericWebHost.cs (1)
11internal class GenericWebHost : IWebHost
230 references to IWebHost
ApiExplorerWebSite (1)
Startup.cs (1)
48var host = CreateWebHostBuilder(args)
ApplicationModelWebSite (1)
Startup.cs (1)
37var host = CreateWebHostBuilder(args)
Aspire.Dashboard.Tests (2)
Integration\MockOpenIdAuthority.cs (2)
26var webHost = new WebHostBuilder() 130public sealed class Authority(IWebHost webHost, string url) : IAsyncDisposable
ControllersFromServicesWebSite (1)
Startup.cs (1)
64var host = CreateWebHostBuilder(args)
CorsWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
DefaultBuilder.SampleApp (1)
Program.cs (1)
77using (var host = WebHost.CreateDefaultBuilder(args)
ErrorPageMiddlewareWebSite (1)
Startup.cs (1)
27var host = CreateWebHostBuilder(args)
FilesWebSite (1)
Startup.cs (1)
26var host = CreateWebHostBuilder(args)
FormatterWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
HtmlGenerationWebSite (1)
Startup.cs (1)
51var host = CreateWebHostBuilder(args)
IdentitySample.Mvc (1)
Program.cs (1)
11var host = CreateHostBuilder(args).Build();
InProcessWebSite (5)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Program.cs (5)
59var host = new WebHostBuilder() 70var host = new WebHostBuilder() 97var host = new WebHostBuilder() 134var host = new WebHostBuilder() 192var host = new WebHostBuilder()
Interop.FunctionalTests (5)
Http3\Http3TlsTests.cs (2)
382var host = hostBuilder.Build(); 423var host = hostBuilder.Build();
src\Servers\Kestrel\shared\test\TransportTestHelpers\IWebHostPortExtensions.cs (3)
13public static int GetPort(this IWebHost host) 18public static IEnumerable<int> GetPorts(this IWebHost host) 24public static IEnumerable<Uri> GetUris(this IWebHost host)
IStartupInjectionAssemblyName (1)
Program.cs (1)
14var webHost = CreateWebHostBuilder(args).Build();
Microsoft.AspNetCore (22)
ConfigureWebHostBuilder.cs (1)
31IWebHost IWebHostBuilder.Build()
WebHost.cs (21)
22/// Provides convenience methods for creating instances of <see cref="IWebHost"/> and <see cref="IWebHostBuilder"/> with pre-configured defaults. 27/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 31/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 32public static IWebHost Start(RequestDelegate app) => 36/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 41/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 42public static IWebHost Start([StringSyntax(StringSyntaxAttribute.Uri)] string url, RequestDelegate app) 49/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 53/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 54public static IWebHost Start(Action<IRouteBuilder> routeBuilder) => 58/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 63/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 64public static IWebHost Start([StringSyntax(StringSyntaxAttribute.Uri)] string url, Action<IRouteBuilder> routeBuilder) 71/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 75/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 76public static IWebHost StartWith(Action<IApplicationBuilder> app) => 80/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. 85/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> 86public static IWebHost StartWith([StringSyntax(StringSyntaxAttribute.Uri)] string url, Action<IApplicationBuilder> app) => 89private static IWebHost StartWith(string? url, Action<IServiceCollection>? configureServices, Action<IApplicationBuilder> app, string? applicationName) 110var host = builder.Build();
Microsoft.AspNetCore.DataProtection.Tests (1)
HostingTests.cs (1)
37using (var host = builder.Build())
Microsoft.AspNetCore.FunctionalTests (1)
WebHostFunctionalTests.cs (1)
122using (var webHost = WebHost.Start("http://127.0.0.1:0", context => context.Response.WriteAsync("Hello, World!")))
Microsoft.AspNetCore.Hosting (18)
GenericHost\HostingStartupWebHostBuilder.cs (1)
26public IWebHost Build()
GenericHost\WebHostBuilderBase.cs (1)
29public IWebHost Build()
WebHostBuilder.cs (3)
21/// A builder for <see cref="IWebHost"/> 127/// Builds the required services and an <see cref="IWebHost"/> which hosts a web application. 129public IWebHost Build()
WebHostExtensions.cs (13)
13/// Contains extensions for managing the lifecycle of an <see cref="IWebHost"/>. 23/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> stops.</returns> 24public static async Task StopAsync(this IWebHost host, TimeSpan timeout) 33/// <param name="host">The running <see cref="IWebHost"/>.</param> 34public static void WaitForShutdown(this IWebHost host) 42/// <param name="host">The running <see cref="IWebHost"/>.</param> 45public static async Task WaitForShutdownAsync(this IWebHost host, CancellationToken token = default) 68/// <param name="host">The <see cref="IWebHost"/> to run.</param> 69public static void Run(this IWebHost host) 77/// <param name="host">The <see cref="IWebHost"/> to run.</param> 79public static async Task RunAsync(this IWebHost host, CancellationToken token = default) 108private static async Task RunAsync(this IWebHost host, CancellationToken token, string? startupMessage) 152private static async Task WaitForTokenShutdownAsync(this IWebHost host, CancellationToken cancellationToken)
Microsoft.AspNetCore.Hosting.Abstractions (13)
HostingAbstractionsWebHostBuilderExtensions.cs (2)
172public static IWebHost Start(this IWebHostBuilder hostBuilder, [StringSyntax(StringSyntaxAttribute.Uri)] params string[] urls) 174var host = hostBuilder.UseUrls(urls).Build();
HostingStartupAttribute.cs (1)
9/// Marker attribute indicating an implementation of <see cref="IHostingStartup"/> that will be loaded and executed when building an <see cref="IWebHost"/>.
IHostingStartup.cs (1)
7/// Represents platform specific configuration that will be applied to a <see cref="IWebHostBuilder"/> when building an <see cref="IWebHost"/>.
IWebHost.cs (2)
32/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> starts.</returns> 39/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> stops.</returns>
IWebHostBuilder.cs (3)
11/// A builder for <see cref="IWebHost"/>. 16/// Builds an <see cref="IWebHost"/> which hosts a web application. 18IWebHost Build();
WebHostBuilderContext.cs (4)
9/// Context containing the common services on the <see cref="IWebHost" />. Some properties may be null until set by the <see cref="IWebHost" />. 14/// The <see cref="IWebHostEnvironment" /> initialized by the <see cref="IWebHost" />. 19/// The <see cref="IConfiguration" /> containing the merged configuration of the application and the <see cref="IWebHost" />.
Microsoft.AspNetCore.Hosting.Tests (94)
Fakes\GenericWebHostBuilderWrapper.cs (1)
24public IWebHost Build()
WebHostBuilderTests.cs (54)
31using (var host = builder.UseStartup("MyStartupAssembly").Build()) 44using (var host = builder.UseServer(server).UseStartup("MissingStartupAssembly").Build()) 56var host = builder.UseServer(server).UseStartup<StartupStaticCtorThrows>().Build(); 86var host = builder.UseServer(server) 119var host = builder.UseServer(server) 134var host = builder.UseServer(server).UseStartup<StartupCtorThrows>().Build(); 147var host = builder.UseServer(server).UseStartup<StartupThrowTypeLoadException>().Build(); 160var host = builder.UseServer(server).UseStartup<StartupCtorThrows>().Build(); 177var host = builder.UseServer(server).UseStartup<StartupConfigureServicesThrows>().Build(); 190var host = builder.UseServer(server).UseStartup<StartupConfigureServicesThrows>().Build(); 206using (var host = hostBuilder.Build()) 232using var host = hostBuilder.Build(); 260using var host = hostBuilder.Build(); 310using (var host = builder.Build()) 367using (var host = hostBuilder.Build()) 408using (var host = hostBuilder.Build()) 477using (var host = hostBuilder.Build()) 496using (var host = hostBuilder.Build()) 522using (var host = hostBuilder.Build()) 548using (var host = hostBuilder.Build()) 583using (var host = hostBuilder.Build()) 604using (var host = builder 632using (var host = builder 652using (var host = builder 672using (var host = builder 695using (var host = builder 716using var host = builder.Build(); 727using (var host = builder 745using (var host = builder 763using var host = builder 776using (var host = builder 792using (var host = builder 808using (var host = builder 822using (var host = builder 858using (var host = builder.UseServer(server) 874using (var host = builder.UseServer(server) 894using (var host = builder.Build()) 914using (var host = builder.Build()) 931using (var host = builder.Build()) 952using (var host = builder.Build()) 976var host = CreateWebHostBuilder() 1052using (var host = builder.Build()) 1073using (var host = builder.Build()) 1090using (var host = builder.Build()) 1126using (var host = builder.Build()) 1206using (var host = builder.Build()) 1226using (var host = builder.Build()) 1250using var host = builder.Build(); 1279using (var host = builder.Build()) 1299using var host = hostBuilder.Build(); 1336using var host = builder.Build(); 1352using (var host = builder.Build()) 1377using var host = builder.Build(); 1406using var host = builder.Build();
WebHostTests.AsyncDisposable.cs (1)
14using (var host = CreateBuilder()
WebHostTests.cs (38)
40using (var host = CreateBuilder().UseFakeServer().Build()) 59using (var host = CreateBuilder(config).UseFakeServer().Build()) 78using (var host = CreateBuilder(config).UseFakeServer().Build()) 98using (var host = CreateBuilder(config).UseFakeServer().Build()) 110using (var host = CreateBuilder().UseFakeServer().PreferHostingUrls(true).Build()) 129using (var host = CreateBuilder(config).UseFakeServer().PreferHostingUrls(true).Build()) 139using (var host = CreateBuilder() 158using (var host = CreateBuilder() 213using (var host = CreateBuilder(config) 252using (var host = CreateBuilder(config) 288using (var host = CreateBuilder(config) 310using (var host = CreateBuilder() 372using (var host = CreateBuilder() 405using (var host = CreateBuilder() 426using (var host = CreateBuilder() 462using (var host = CreateBuilder() 486using (var host = CreateBuilder() 523using (var host = CreateBuilder() 547using (var host = CreateBuilder() 575using (var host = CreateBuilder() 628using (var host = CreateBuilder() 671using (var host = CreateBuilder() 707using (var host = CreateBuilder() 740using (var host = CreateBuilder().UseFakeServer().ConfigureServices(services => services.AddOptions()).Build()) 751using (var host = CreateBuilder() 799using (var host = CreateBuilder().UseFakeServer().Build()) 822using (var host = CreateBuilder(config).UseFakeServer().Build()) 845using (var host = CreateBuilder(config).UseFakeServer().Build()) 862using (var host = CreateBuilder().UseFakeServer().Build()) 886using (var host = CreateHost(requestDelegate)) 907using (var host = CreateHost(requestDelegate)) 924using (var host = CreateBuilder() 951using (var host = CreateHost(requestDelegate)) 1004var host = CreateBuilder() 1028var host = CreateBuilder() 1047using (var host = CreateBuilder() 1066using (var host = CreateBuilder() 1088private IWebHost CreateHost(RequestDelegate requestDelegate)
Microsoft.AspNetCore.Hosting.TestSites (2)
Program.cs (2)
38var host = builder.Build(); 44using (var host = builder.Build())
Microsoft.AspNetCore.Hosting.WindowsServices (5)
WebHostService.cs (2)
17private readonly IWebHost _host; 24public WebHostService(IWebHost host)
WebHostWindowsServiceExtensions.cs (3)
9/// Extensions to <see cref="IWebHost"/> for hosting inside a Windows service. 16/// <param name="host">An instance of the <see cref="IWebHost"/> to host in the Windows service.</param> 36public static void RunAsService(this IWebHost host)
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (2)
WebHostServiceTests.cs (2)
22var host = new WebHostBuilder().UseServer(new FakeServer()).Configure(x => { }).Build(); 36var host = new WebHostBuilder().UseServer(new FakeServer()).Configure(x => { }).Build();
Microsoft.AspNetCore.Server.Kestrel.Tests (7)
HttpsConfigurationTests.cs (7)
40var host = hostBuilder.Build(); 69var host = hostBuilder.Build(); 102var host = hostBuilder.Build(); 139var host = hostBuilder.Build(); 172var host = hostBuilder.Build(); 202var host = hostBuilder.Build(); 228var host = hostBuilder.Build();
Microsoft.AspNetCore.TestHost (7)
TestServer.cs (5)
19private readonly IWebHost? _hostInstance; 97var host = builder.UseServer(this).Build(); 110/// Gets the <see cref="IWebHost" /> instance associated with the test server. 112public IWebHost Host 234/// Dispose the <see cref="IWebHost" /> object associated with the test server.
WebHostBuilderExtensions.cs (2)
54public static TestServer GetTestServer(this IWebHost host) 64public static HttpClient GetTestClient(this IWebHost host)
Microsoft.AspNetCore.TestHost.Tests (8)
ClientHandlerTests.cs (2)
697services.AddSingleton<ILogger<IWebHost>>(logger); 712private class VerifierLogger : ILogger<IWebHost>
HttpContextBuilderTests.cs (2)
312services.AddSingleton<ILogger<IWebHost>>(logger); 348private class VerifierLogger : ILogger<IWebHost>
TestClientTests.cs (3)
604services.AddSingleton<ILogger<IWebHost>>(logger); 724.ConfigureServices(services => services.AddSingleton<ILogger<IWebHost>>(logger)) 737private class VerifierLogger : ILogger<IWebHost>
TestServerTests.cs (1)
105using var host = builder.Build();
Microsoft.AspNetCore.Tests (5)
WebHostTests.cs (5)
32var host = WebHost.CreateDefaultBuilder() 60using var host = WebHost.CreateDefaultBuilder() 89var host = WebHost.CreateDefaultBuilder() 101var host = WebHost.CreateDefaultBuilder() 117var host = WebHost.CreateDefaultBuilder()
Microsoft.Extensions.Http.Resilience.Tests (1)
Resilience\GrpcResilienceTests.cs (1)
24private IWebHost _host;
Mvc.RoutingWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
MvcSandbox (1)
Startup.cs (1)
45var host = CreateWebHostBuilder(args)
RazorBuildWebSite (1)
StartupWithHostingStartup.cs (1)
37var host = CreateWebHostBuilder(args)
RazorPagesWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
RazorWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
SecurityWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
ServerComparison.TestSites (1)
Program.cs (1)
49var host = builder.Build();
SimpleWebSite (1)
Startup.cs (1)
32var host = CreateWebHostBuilder(args)
SocialSample (1)
Program.cs (1)
12var host = WebHost.CreateDefaultBuilder(args)
Sockets.BindTests (3)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IWebHostPortExtensions.cs (3)
13public static int GetPort(this IWebHost host) 18public static IEnumerable<int> GetPorts(this IWebHost host) 24public static IEnumerable<Uri> GetUris(this IWebHost host)
Sockets.FunctionalTests (3)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IWebHostPortExtensions.cs (3)
13public static int GetPort(this IWebHost host) 18public static IEnumerable<int> GetPorts(this IWebHost host) 24public static IEnumerable<Uri> GetUris(this IWebHost host)
StartRequestDelegateUrlApp (1)
Program.cs (1)
20using (var host = WebHost.Start("http://127.0.0.1:0", async context =>
StartRouteBuilderUrlApp (1)
Program.cs (1)
21using (var host = WebHost.Start("http://127.0.0.1:0", router =>
StartWithIApplicationBuilderUrlApp (1)
Program.cs (1)
22using (var host = WebHost.StartWith("http://127.0.0.1:0", app =>
TagHelpersWebSite (1)
Startup.cs (1)
26var host = CreateWebHostBuilder(args)
VersioningWebSite (1)
Program.cs (1)
10var host = CreateWebHostBuilder(args)
XmlFormattersWebSite (1)
Startup.cs (1)
112var host = CreateWebHostBuilder(args)