15 implementations of IServer
InProcessWebSite (1)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\DummyServer.cs (1)
12public class DummyServer : IServer
Microsoft.AspNetCore.DataProtection.Tests (1)
HostingTests.cs (1)
107public class FakeServer : IServer
Microsoft.AspNetCore.Hosting.Tests (4)
GenericWebHostBuilderTests.cs (1)
131private class TestServer : IServer, IServerAddressesFeature
WebHostBuilderTests.cs (2)
1445private class ServerMustBeStartedSecond : IServer 1568private class TestServer : IServer
WebHostTests.cs (1)
1224public class FakeServer : IServer
Microsoft.AspNetCore.Hosting.TestSites (1)
Program.cs (1)
58public class NoopServer : IServer
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (1)
WebHostServiceTests.cs (1)
47private sealed class FakeServer : IServer
Microsoft.AspNetCore.Server.HttpSys (1)
MessagePump.cs (1)
16internal sealed partial class MessagePump : IServer, IServerDelegationFeature
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpServer.cs (1)
19internal 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 3089private class MockAddressesServer : IServer
176 references to IServer
Aspire.Hosting (1)
Dashboard\DashboardServiceHost.cs (1)
203var addressFeature = _app.Services.GetService<IServer>()?.Features.Get<IServerAddressesFeature>();
InMemory.FunctionalTests (1)
TestTransport\TestServer.cs (1)
94services.AddSingleton<IServer>(sp =>
InProcessWebSite (6)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Program.cs (1)
99.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (5)
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)
34.AddSingleton<IServer>( 60.AddSingleton<IServer>( 81var mockServer = new Mock<IServer>();
Microsoft.AspNetCore.Hosting (4)
GenericHost\GenericWebHostService.cs (2)
20IServer server, 48public IServer Server { get; }
Internal\WebHost.cs (2)
46private IServer? Server { get; set; } 259Server = _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)
20public IFeatureCollection ServerFeatures => Services.GetRequiredService<IServer>().Features;
WebHostBuilderTests.cs (2)
1403services.AddSingleton<IServer, ServerMustBeStartedSecond>(); 1570IFeatureCollection IServer.Features { get; } = new FeatureCollection();
WebHostTests.cs (9)
144var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 167var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 203var server = new Mock<IServer>(); 242var server = new Mock<IServer>(); 278var server = new Mock<IServer>(); 909var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 1045var server = new Mock<IServer>(); 1064var server = new Mock<IServer>(); 1457return builder.ConfigureServices(services => services.AddSingleton<IServer, WebHostTests.FakeServer>());
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (1)
WebHostServiceTests.cs (1)
49IFeatureCollection 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.Testing (1)
WebApplicationFactory.cs (1)
214_server = (TestServer)_host.Services.GetRequiredService<IServer>();
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiDocumentServiceTestsBase.cs (1)
336internal class OpenApiTestServer(string[] addresses = null) : IServer
Microsoft.AspNetCore.Server.HttpSys (1)
WebHostBuilderHttpSysExtensions.cs (1)
32services.AddSingleton<IServer>(services => services.GetRequiredService<MessagePump>());
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (81)
DelegateTests.cs (15)
30var server = host.Services.GetRequiredService<IServer>(); 40using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 51using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 71using var receiver = Utilities.CreateHttpServer(out var receiverAddress, httpContext => 83using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, async httpContext => 104using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 115using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 137using var receiver = Utilities.CreateHttpServer(out var receiverAddress, httpContext => 149using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, async httpContext => 171using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 189using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 200using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext => 223using var receiver = Utilities.CreateHttpServer(out var receiverAddress, async httpContext => 233using var delegator = Utilities.CreateHttpServer(out var delegatorAddress, httpContext =>
Http2Tests.cs (22)
33using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 70using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 116using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 166using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 230using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 287using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 322using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 366using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 405using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 444using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 518using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 551using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 583using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 614using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 636using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 657using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext => 699using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 746using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 796using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 848using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 894using var server = Utilities.CreateDynamicHttpsServer(out var address, async httpContext => 943using 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)
43internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 49internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app, Action<HttpSysOptions> configureOptions, ILoggerFactory loggerFactory) 55internal static IServer CreateHttpServerReturnRoot(string path, out string root, RequestDelegate app, ILoggerFactory loggerFactory) 61internal static IServer CreateHttpAuthServer(AuthenticationSchemes authType, bool allowAnonymous, out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 124internal static IServer CreateDynamicHttpServer(string basePath, out string root, out string baseAddress, Action<HttpSysOptions> configureOptions, RequestDelegate app, ILoggerFactory loggerFactory) 139internal static IServer CreateDynamicHttpsServer(out string baseAddress, RequestDelegate app, ILoggerFactory loggerFactory) 144internal 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)
27internal static IServer CreateHttpServer(out string baseAddress, RequestDelegate app) 43internal 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)
38services.AddSingleton<IServer, IISHttpServer>();
Microsoft.AspNetCore.Server.Kestrel (1)
WebHostBuilderKestrelExtensions.cs (1)
89services.AddSingleton<IServer, KestrelServerImpl>();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
KestrelServerTests.cs (1)
982private static void StartDummyApplication(IServer server)
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
WebHostBuilderKestrelExtensionsTests.cs (1)
110Assert.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. 245Task IServer.StartAsync<TContext>(IHttpApplication<TContext> application, CancellationToken cancellationToken) 255Task IServer.StopAsync(CancellationToken cancellationToken)
WebHostBuilderExtensions.cs (3)
29services.AddSingleton<IServer, TestServer>(); 45services.AddSingleton<IServer, TestServer>(); 56return (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())); 1757Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer))); 1765Assert.Single(app.Services.GetRequiredService<IEnumerable<IServer>>()); 1775Assert.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
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)
92services.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)
92services.AddSingleton<IServer>(sp =>
TestProject.ServiceA (1)
Program.cs (1)
13app.MapGet("/urls", (IServiceProvider sp) => sp.GetService<IServer>()?.Features?.Get<IServerAddressesFeature>()?.Addresses);
Wasm.Performance.Driver (1)
Program.cs (1)
328return testApp.Services.GetRequiredService<IServer>()