3 implementations of IServerAddressesFeature
Microsoft.AspNetCore.Hosting (1)
Server\Features\ServerAddressesFeature.cs (1)
11public class ServerAddressesFeature : IServerAddressesFeature
Microsoft.AspNetCore.Server.IIS (1)
Core\ServerAddressesFeature.cs (1)
8internal sealed class ServerAddressesFeature : IServerAddressesFeature
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\ServerAddressesFeature.cs (1)
12internal sealed class ServerAddressesFeature : IServerAddressesFeature
40 references to IServerAddressesFeature
Aspire.Dashboard.Tests (2)
Integration\MockOpenIdAuthority.cs (2)
118var serverAddress = webHost.ServerFeatures.Get<IServerAddressesFeature>();
Aspire.Hosting (2)
Dashboard\DashboardServiceHost.cs (2)
265var addressFeature = _app.Services.GetService<IServer>()?.Features.Get<IServerAddressesFeature>();
Microsoft.AspNetCore (4)
WebApplication.cs (4)
69public ICollection<string> Urls => ServerFeatures.GetRequiredFeature<IServerAddressesFeature>().Addresses; 239var addresses = ServerFeatures.Get<IServerAddressesFeature>()?.Addresses; 242throw new InvalidOperationException($"Changing the URL is not supported because no valid {nameof(IServerAddressesFeature)} was found."); 246throw new InvalidOperationException($"Changing the URL is not supported because {nameof(IServerAddressesFeature.Addresses)} {nameof(ICollection<string>.IsReadOnly)}.");
Microsoft.AspNetCore.Hosting (5)
GenericHost\GenericWebHostService.cs (2)
66var serverAddressesFeature = Server.Features.Get<IServerAddressesFeature>();
Internal\WebHost.cs (2)
262var serverAddressesFeature = Server.Features?.Get<IServerAddressesFeature>();
WebHostExtensions.cs (1)
122var serverAddresses = host.ServerFeatures.Get<IServerAddressesFeature>()?.Addresses;
Microsoft.AspNetCore.HttpsPolicy (4)
HttpsRedirectionBuilderExtensions.cs (2)
23var serverAddressFeature = app.ServerFeatures.Get<IServerAddressesFeature>();
HttpsRedirectionMiddleware.cs (2)
25private readonly IServerAddressesFeature? _serverAddressesFeature; 67IServerAddressesFeature serverAddressesFeature)
Microsoft.AspNetCore.Mvc.Testing (7)
WebApplicationFactory.cs (7)
226private void TryConfigureServerPort(Func<IServerAddressesFeature?> serverAddressFeatureAccessor) 230var saf = serverAddressFeatureAccessor(); 376private void TryExtractHostAddress(IServerAddressesFeature? serverAddressFeature) 663private static IServerAddressesFeature? GetServerAddressFeature(IHost host) => host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>(); 666private static IServerAddressesFeature? GetServerAddressFeature(IWebHost webHost) => webHost.ServerFeatures.Get<IServerAddressesFeature>();
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiDocumentService.cs (1)
231server?.Features.Get<IServerAddressesFeature>()?.Addresses is { Count: > 0 } addresses)
Microsoft.AspNetCore.Server.HttpSys (2)
MessagePump.cs (1)
53Features.Set<IServerAddressesFeature>(_serverAddresses);
MessagePump.Log.cs (1)
46$"Overriding endpoints added to {nameof(HttpSysOptions.UrlPrefixes)} since {nameof(IServerAddressesFeature.PreferHostingUrls)} is set to true. Binding to address(es) '{{ServerAddresses}}' instead.",
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpServer.cs (1)
81Features.Set<IServerAddressesFeature>(_serverAddressesFeature);
Microsoft.AspNetCore.Server.Kestrel.Core (5)
Internal\AddressBinder.cs (1)
200context.Logger.LogInformation(CoreStrings.OverridingWithPreferHostingUrls, nameof(IServerAddressesFeature.PreferHostingUrls), joined);
Internal\KestrelServerImpl.cs (1)
72Features.Set<IServerAddressesFeature>(_serverAddresses);
Internal\ServerAddressesCollection.cs (2)
169throw new InvalidOperationException($"{nameof(IServerAddressesFeature)}.{nameof(IServerAddressesFeature.Addresses)} cannot be modified after the server has started.");
Internal\ServerAddressesFeature.cs (1)
16ICollection<string> IServerAddressesFeature.Addresses => InternalCollection.PublicCollection;
Microsoft.AspNetCore.TestHost (1)
TestServer.cs (1)
29features.Set<IServerAddressesFeature>(new ServerAddressesFeature());
Microsoft.AspNetCore.Testing (2)
ServiceFakesHostExtensions.cs (2)
70var feature = server.Features.Get<IServerAddressesFeature>();
Microsoft.AspNetCore.Testing.Tests (2)
FakesExtensionsTests.cs (2)
199hostMock.Object.Services.GetRequiredService<IServer>().Features[typeof(IServerAddressesFeature)] = null; 243var features = new FeatureCollection { [typeof(IServerAddressesFeature)] = addressesFeature };
Microsoft.DotNet.HotReload.Watch (1)
src\sdk\src\Dotnet.Watch\HotReloadClient\Web\KestrelWebSocketServer.cs (1)
64.Get<IServerAddressesFeature>()?
TestProject.ServiceA (1)
Program.cs (1)
15app.MapGet("/urls", (IServiceProvider sp) => sp.GetService<IServer>()?.Features?.Get<IServerAddressesFeature>()?.Addresses);