19 implementations of IServer
GetDocument.Insider (1)
Commands\GetDocumentCommandWorker.cs (1)
480private sealed class NoopServer : IServer
InProcessWebSite (1)
DummyServer.cs (1)
12public class DummyServer : IServer
Microsoft.AspNetCore.DataProtection.Tests (1)
HostingTests.cs (1)
111public class FakeServer : IServer
Microsoft.AspNetCore.Hosting.Tests (4)
GenericWebHostBuilderTests.cs (1)
213private class TestServer : IServer, IServerAddressesFeature
WebHostBuilderTests.cs (2)
1449private class ServerMustBeStartedSecond : IServer 1578private class TestServer : IServer
WebHostTests.cs (1)
1228public class FakeServer : IServer
Microsoft.AspNetCore.Hosting.TestSites (1)
Program.cs (1)
62public class NoopServer : IServer
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (1)
WebHostServiceTests.cs (1)
59private sealed class FakeServer : IServer
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
215private sealed class NoopServer : IServer
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiDocumentServiceTestsBase.cs (1)
342internal class OpenApiTestServer(string[] addresses = null) : IServer
Microsoft.AspNetCore.Server.HttpSys (1)
MessagePump.cs (1)
17internal sealed partial class MessagePump : IServer, IServerDelegationFeature
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpServer.cs (1)
20internal sealed class IISHttpServer : IServer
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Internal\KestrelServerImpl.cs (1)
20internal sealed class KestrelServerImpl : IServer
KestrelServer.cs (1)
21public class KestrelServer : IServer
Microsoft.AspNetCore.TestHost (1)
TestServer.cs (1)
17public class TestServer : IServer
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
322class MockServer : IServer 3091private class MockAddressesServer : IServer
Microsoft.Extensions.Validation.GeneratorTests (1)
ValidationsGeneratorTestBase.cs (1)
215private sealed class NoopServer : IServer
191 references to IServer
Aspire.Hosting (1)
Dashboard\DashboardServiceHost.cs (1)
207var addressFeature = _app.Services.GetService<IServer>()?.Features.Get<IServerAddressesFeature>();
GetDocument.Insider (1)
Commands\GetDocumentCommandWorker.cs (1)
73services.AddSingleton<IServer, NoopServer>();
InMemory.FunctionalTests (1)
TestTransport\TestServer.cs (1)
94services.AddSingleton<IServer>(sp =>
InProcessWebSite (7)
Program.cs (1)
109.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
Startup.cs (6)
89var envFeature = ctx.RequestServices.GetService<IServer>().Features.Get<IIISEnvironmentFeature>(); 107var serverAddresses = ctx.RequestServices.GetService<IServer>().Features.Get<IServerAddressesFeature>(); 1005var server = ctx.RequestServices.GetService<IServer>(); 1012var server = ctx.RequestServices.GetService<IServer>();
Interop.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
Microsoft.AspNetCore (1)
WebApplication.cs (1)
77internal IFeatureCollection ServerFeatures => _host.Services.GetRequiredService<IServer>().Features;
Microsoft.AspNetCore.DataProtection.Tests (3)
HostingTests.cs (3)
35.AddSingleton<IServer>( 64.AddSingleton<IServer>( 85var mockServer = new Mock<IServer>();
Microsoft.AspNetCore.Hosting (4)
GenericHost\GenericWebHostService.cs (2)
20IServer server, 48public IServer Server { get; }
Internal\WebHost.cs (2)
47private IServer? Server { get; set; } 260Server = _applicationServices.GetRequiredService<IServer>();
Microsoft.AspNetCore.Hosting.Abstractions (3)
HostingAbstractionsWebHostBuilderExtensions.cs (3)
66/// <param name="server">The <see cref="IServer"/> to be used.</param> 68public static IWebHostBuilder UseServer(this IWebHostBuilder hostBuilder, IServer server) 134/// instead of those configured on the <see cref="IServer"/>.
Microsoft.AspNetCore.Hosting.Tests (12)
Fakes\GenericWebHost.cs (1)
22public IFeatureCollection ServerFeatures => Services.GetRequiredService<IServer>().Features;
WebHostBuilderTests.cs (2)
1407services.AddSingleton<IServer, ServerMustBeStartedSecond>(); 1580IFeatureCollection IServer.Features { get; } = new FeatureCollection();
WebHostTests.cs (9)
146var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 169var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 205var server = new Mock<IServer>(); 244var server = new Mock<IServer>(); 280var server = new Mock<IServer>(); 911var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 1047var server = new Mock<IServer>(); 1066var server = new Mock<IServer>(); 1461return builder.ConfigureServices(services => services.AddSingleton<IServer, WebHostTests.FakeServer>());
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (1)
WebHostServiceTests.cs (1)
61IFeatureCollection IServer.Features { get; }
Microsoft.AspNetCore.Http.Connections.Tests (6)
HttpConnectionDispatcherTests.cs (5)
3252var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3315var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3414var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3464var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3538var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single();
MapConnectionHandlerTests.cs (1)
396var feature = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>();
Microsoft.AspNetCore.Mvc.FunctionalTests (4)
RealServerBackedIntegrationTests.cs (2)
59var server = Factory.Services.GetRequiredService<IServer>();
RealServerUsingMinimalBackedIntegrationTests.cs (2)
56var server = Factory.Services.GetRequiredService<IServer>();
Microsoft.AspNetCore.Mvc.Testing (3)
WebApplicationFactory.cs (3)
353services.AddSingleton<IServer>(CreateServer); 364_server = (TestServer)_host.Services.GetRequiredService<IServer>(); 607private static IServerAddressesFeature? GetServerAddressFeature(IHost host) => host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>();
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiDocumentService.cs (1)
39IServer? server = null) : IOpenApiDocumentProvider
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
155services.AddSingleton<IServer, NoopServer>();
Microsoft.AspNetCore.Server.HttpSys (1)
WebHostBuilderHttpSysExtensions.cs (1)
34services.AddSingleton<IServer>(services => services.GetRequiredService<MessagePump>());
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (83)
DelegateTests.cs (17)
34var server = host.Services.GetRequiredService<IServer>(); 44using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 55using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 75using var receiver = Utilities.CreateHttpServer(out var receiverAddress, httpContext => 87using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, async httpContext => 108using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 119using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 141using var receiver = Utilities.CreateHttpServer(out var receiverAddress, httpContext => 153using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, async httpContext => 175using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 193using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 204using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 228using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 238using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 289using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 301using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext =>
Http2Tests.cs (22)
32using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 69using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 115using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 165using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 229using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 286using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 321using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 365using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 404using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 443using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 517using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 550using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 582using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 613using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 635using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 656using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 698using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 745using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 795using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 847using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 893using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 942using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext =>
Http3Tests.cs (8)
26using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 52using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 92using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 129using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 158using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 186using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 219using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 244using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
RequestHeaderTests.cs (3)
41using var server = Utilities.CreateHttpServer(out var address, httpContext => 184using var server = Utilities.CreateHttpServer(out var address, httpContext => 211using var server = Utilities.CreateHttpServer(out var address, httpContext =>
RequestTests.cs (14)
244using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 261using (var server = Utilities.CreateHttpServerReturnRoot("/", out var root, httpContext => 280using (var server = Utilities.CreateHttpServerReturnRoot("/", out var root, httpContext => 349using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 368using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 406using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 430using (var server = Utilities.CreateHttpServerReturnRoot(basePath, out root, httpContext => 451using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 469using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 491using (var server = Utilities.CreateHttpServerReturnRoot("/", out root, httpContext => 510using var server = Utilities.CreateHttpServerReturnRoot("/", out var address, async httpContext => 559using var server = Utilities.CreateHttpServerReturnRoot("/", out var address, async httpContext => 600private IServer CreateServer(out string root, RequestDelegate app) 603var dynamicServer = Utilities.CreateHttpServerReturnRoot("/", out root, app, LoggerFactory);
ResponseTests.cs (1)
222using var server = Utilities.CreateHttpServer(out var address, async httpContext =>
ServerTests.cs (11)
149using (var server = Utilities.CreateHttpServer(out var address, httpContext => 170using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 191using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 420using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 454using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 491using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 528using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 567using (var server = Utilities.CreateHttpServer(out var address, async httpContext => 592using (var server = Utilities.CreateHttpServer(out _, httpContext => Task.CompletedTask, LoggerFactory)) 604using var server = Utilities.CreateHttpServer(out var address, httpContext => Task.CompletedTask, options => 622using var server = Utilities.CreateHttpServer(
Utilities.cs (7)
44internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 50internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app, Action<HttpSysOptions> configureOptions, ILoggerFactory loggerFactory) 56internal static IServer CreateHttpServerReturnRoot(string path, out string root, RequestDelegate app, ILoggerFactory loggerFactory) 62internal static IServer CreateHttpAuthServer(AuthenticationSchemes authType, bool allowAnonymous, out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 125internal static IServer CreateDynamicHttpServer(string basePath, out string root, out string baseAddress, Action<HttpSysOptions> configureOptions, RequestDelegate app, ILoggerFactory loggerFactory) 140internal static IServer CreateDynamicHttpsServer(out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 145internal static IServer CreateDynamicHttpsServer(string basePath, out string root, out string baseAddress, Action<HttpSysOptions> configureOptions, RequestDelegate app, ILoggerFactory loggerFactory = null)
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (3)
DelegateOutOfProcTests.cs (1)
53using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext =>
Utilities.cs (2)
28internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app) 44internal static IServer CreateDynamicHttpServer(string basePath, out string root, out string baseAddress, Action<HttpSysOptions> configureOptions, RequestDelegate app)
Microsoft.AspNetCore.Server.IIS (3)
Core\IISServerSetupFilter.cs (2)
17var server = app.ApplicationServices.GetService<IServer>();
WebHostBuilderIISExtensions.cs (1)
40services.AddSingleton<IServer, IISHttpServer>();
Microsoft.AspNetCore.Server.Kestrel (1)
WebHostBuilderKestrelExtensions.cs (1)
86services.AddSingleton<IServer, KestrelServerImpl>();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
KestrelServerTests.cs (1)
984private static void StartDummyApplication(IServer server)
Microsoft.AspNetCore.Server.Kestrel.Tests (4)
HttpsConfigurationTests.cs (3)
50Assert.Empty(host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses); 56var addr = Assert.Single(host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses); 83var addr = Assert.Single(host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses);
WebHostBuilderKestrelExtensionsTests.cs (1)
142var server = Assert.IsType<KestrelServerImpl>(hostBuilder.Build().Services.GetService<IServer>());
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
src\Shared\SignalR\InProcessTestServer.cs (1)
129_url = _host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single();
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Helpers.cs (1)
15return server.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.First();
Microsoft.AspNetCore.TestHost (7)
HostBuilderTestServerExtensions.cs (1)
23return (TestServer)host.Services.GetRequiredService<IServer>();
TestServer.cs (3)
15/// An <see cref="IServer"/> implementation for executing tests. 250Task IServer.StartAsync<TContext>(IHttpApplication<TContext> application, CancellationToken cancellationToken) 260Task IServer.StopAsync(CancellationToken cancellationToken)
WebHostBuilderExtensions.cs (3)
31services.AddSingleton<IServer, TestServer>(); 47services.AddSingleton<IServer, TestServer>(); 59return (TestServer)host.Services.GetRequiredService<IServer>();
Microsoft.AspNetCore.TestHost.Tests (1)
TestServerTests.cs (1)
32services.AddSingleton<IServer>(serviceProvider => new TestServer(serviceProvider));
Microsoft.AspNetCore.Testing (3)
ServiceFakesHostExtensions.cs (3)
40var uri = GetListenUris(host.Services.GetRequiredService<IServer>()).FirstOrDefault(addressFilter) 65return GetListenUris(Throw.IfNull(host).Services.GetRequiredService<IServer>()); 68private static IEnumerable<Uri> GetListenUris(IServer server)
Microsoft.AspNetCore.Testing.Tests (6)
FakesExtensionsTests.cs (6)
138services.Setup(x => x.GetService(typeof(IServer))).Returns(null); 185services.Setup(x => x.GetService(typeof(IServer))).Returns(null); 197hostMock.Object.Services.GetRequiredService<IServer>().Features[typeof(IServerAddressesFeature)] = null; 200services.Setup(x => x.GetService(typeof(IServer))).Returns(null); 243var mockServer = new Mock<IServer>(); 247serviceProviderMock.Setup(x => x.GetService(typeof(IServer))).Returns(mockServer.Object);
Microsoft.AspNetCore.Tests (12)
WebApplicationTests.cs (12)
180builder.Services.AddSingleton<IServer>(server); 201builder.Services.AddSingleton<IServer>(server); 220builder.Services.AddSingleton<IServer>(server); 239builder.Services.AddSingleton<IServer>(server); 259builder.Services.AddSingleton<IServer>(server); 279builder.Services.AddSingleton<IServer>(new MockAddressesServer()); 294builder.Services.AddSingleton<IServer>(server); 352builder.Services.AddSingleton<IServer>(new MockAddressesServer()); 363builder.Services.AddSingleton<IServer>(new MockAddressesServer(new List<string>().AsReadOnly())); 1759Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer))); 1767Assert.Single(app.Services.GetRequiredService<IEnumerable<IServer>>()); 1777Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IServer));
Microsoft.AspNetCore.WebSockets.Tests (1)
IHostPortExtensions.cs (1)
26return host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
Microsoft.Extensions.Validation.GeneratorTests (1)
ValidationsGeneratorTestBase.cs (1)
163services.AddSingleton<IServer, NoopServer>();
NativeIISSample (2)
Startup.cs (2)
99var server = context.RequestServices.GetService<IServer>();
Sockets.BindTests (5)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
89services.AddSingleton<IServer>(sp =>
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (3)
632var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses; 677var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses; 717var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses;
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
89services.AddSingleton<IServer>(sp =>
TestProject.ServiceA (1)
Program.cs (1)
15app.MapGet("/urls", (IServiceProvider sp) => sp.GetService<IServer>()?.Features?.Get<IServerAddressesFeature>()?.Addresses);
Wasm.Performance.Driver (1)
Program.cs (1)
328return testApp.Services.GetRequiredService<IServer>()