Implemented interface member:
property
Services
Microsoft.Extensions.Hosting.IHostApplicationBuilder.Services
263 references to Services
ApiGateway (1)
Program.cs (1)
4builder.Services.AddReverseProxy()
Aspire.Dashboard (42)
DashboardWebApplication.cs (42)
159builder.Services.AddOptions<DashboardOptions>() 162builder.Services.AddSingleton<IPostConfigureOptions<DashboardOptions>, PostConfigureDashboardOptions>(); 163builder.Services.AddSingleton<IValidateOptions<DashboardOptions>, ValidateDashboardOptions>(); 191builder.Services.Configure<HttpsRedirectionOptions>(options => options.HttpsPort = browserHttpsPort); 194builder.Services.AddSingleton<IPolicyEvaluator, AspirePolicyEvaluator>(); 199builder.Services.AddRazorComponents().AddInteractiveServerComponents(); 200builder.Services.AddCascadingAuthenticationState(); 201builder.Services.AddResponseCompression(options => 208builder.Services.AddHealthChecks(); 211builder.Services.AddCors(options => 238builder.Services.Configure<ForwardedHeadersOptions>(options => 250builder.Services.TryAddSingleton<IDashboardClient, DashboardClient>(); 251builder.Services.TryAddScoped<DashboardCommandExecutor>(); 253builder.Services.AddSingleton<PauseManager>(); 256builder.Services.TryAddScoped<ComponentTelemetryContextProvider>(); 257builder.Services.TryAddSingleton<DashboardTelemetryService>(); 258builder.Services.TryAddSingleton<IDashboardTelemetrySender, DashboardTelemetrySender>(); 259builder.Services.AddSingleton<ILoggerProvider, TelemetryLoggerProvider>(); 262builder.Services.AddGrpc(); 263builder.Services.AddSingleton<TelemetryRepository>(); 264builder.Services.AddTransient<StructuredLogsViewModel>(); 266builder.Services.AddTransient<OtlpLogsService>(); 267builder.Services.AddTransient<OtlpTraceService>(); 268builder.Services.AddTransient<OtlpMetricsService>(); 270builder.Services.AddTransient<TracesViewModel>(); 271builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOutgoingPeerResolver, ResourceOutgoingPeerResolver>()); 272builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOutgoingPeerResolver, BrowserLinkOutgoingPeerResolver>()); 274builder.Services.AddFluentUIComponents(); 276builder.Services.AddScoped<IThemeResolver, BrowserThemeResolver>(); 277builder.Services.AddScoped<ThemeManager>(); 279builder.Services.AddScoped<ShortcutManager>(); 280builder.Services.AddScoped<ConsoleLogsManager>(); 281builder.Services.AddSingleton<IInstrumentUnitResolver, DefaultInstrumentUnitResolver>(); 284builder.Services.AddScoped<BrowserTimeProvider>(); 285builder.Services.AddScoped<ILocalStorage, LocalBrowserStorage>(); 286builder.Services.AddScoped<ISessionStorage, SessionBrowserStorage>(); 288builder.Services.AddSingleton<IKnownPropertyLookup, KnownPropertyLookup>(); 290builder.Services.AddScoped<DimensionManager>(); 292builder.Services.AddLocalization(); 294builder.Services.AddAntiforgery(options => 689var authentication = builder.Services 816builder.Services.AddAuthorization(options =>
Aspire.Dashboard.Tests (7)
Integration\DashboardClientAuthTests.cs (3)
75serverAppBuilder.Services.AddGrpc(options => options.EnableDetailedErrors = true); 76serverAppBuilder.Services.AddSingleton(testCalls); 77serverAppBuilder.Services.AddSingleton(loggerFactory);
Integration\IntegrationTestHelpers.cs (2)
82builder.Services.PostConfigure<LoggerFilterOptions>(o => 99builder.Services.AddSingleton(loggerFactory);
Integration\Playwright\Infrastructure\DashboardServerFixture.cs (1)
59builder.Services.AddSingleton<IDashboardClient, MockDashboardClient>();
Integration\StartupTests.cs (1)
797builder.Services.TryAddEnumerable(
Aspire.Hosting (15)
Dashboard\DashboardServiceHost.cs (15)
79builder.Services.AddSingleton(configuration); 82builder.Services.AddOptions<ResourceServiceOptions>() 85builder.Services.AddSingleton<IValidateOptions<ResourceServiceOptions>, ValidateResourceServiceOptions>(); 88builder.Services 98builder.Services 108builder.Services.AddSingleton(loggerFactory); 109builder.Services.AddSingleton(loggerOptions); 110builder.Services.Add(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>))); 112builder.Services.AddGrpc(); 113builder.Services.AddSingleton(applicationModel); 114builder.Services.AddSingleton(resourceCommandService); 115builder.Services.AddSingleton<DashboardServiceData>(); 116builder.Services.AddSingleton(resourceNotificationService); 117builder.Services.AddSingleton(resourceLoggerService); 118builder.Services.AddSingleton(interactionService);
AzureAIFoundryEndToEnd.WebStory (1)
Program.cs (1)
14builder.Services.AddRazorComponents()
AzureOpenAIEndToEnd.WebStory (1)
Program.cs (1)
14builder.Services.AddRazorComponents()
BasketService (2)
Program.cs (2)
6builder.Services.AddGrpc(); 9builder.Services.AddTransient<IBasketRepository, RedisBasketRepository>();
BlazorUnitedApp (2)
Program.cs (2)
10builder.Services.AddRazorComponents() 14builder.Services.AddSingleton<WeatherForecastService>();
BrowserTelemetry.Web (1)
Program.cs (1)
8builder.Services.AddRazorPages();
CatalogDb (4)
Program.cs (4)
9builder.Services.AddOpenTelemetry() 12builder.Services.AddSingleton<CatalogDbInitializer>(); 13builder.Services.AddHostedService(sp => sp.GetRequiredService<CatalogDbInitializer>()); 14builder.Services.AddHealthChecks()
CatalogService (1)
Program.cs (1)
9builder.Services.AddProblemDetails();
CdkSample.ApiService (2)
Program.cs (2)
27builder.Services.AddSignalR().AddNamedAzureSignalR("signalr"); 29builder.Services.AddAzureClients(clients =>
CookieSample (1)
Program.cs (1)
11builder.Services
DatabaseMigration.ApiService (1)
Program.cs (1)
12builder.Services.AddDbContextPool<MyDb1Context>(options =>
GetDocumentSample (2)
Program.cs (2)
12builder.Services.AddOpenApi(); 13builder.Services.AddOpenApi("internal");
GitHubModelsEndToEnd.WebStory (1)
Program.cs (1)
14builder.Services.AddRazorComponents()
IdentitySample.ApiEndpoints (3)
Program.cs (3)
15builder.Services.AddAuthorization(); 17builder.Services.AddDbContext<ApplicationDbContext>( 19builder.Services.AddIdentityApiEndpoints<IdentityUser>()
IdentitySample.PasskeyConformance (4)
Program.cs (4)
15builder.Services.AddAuthentication(options => 28builder.Services.AddIdentityCore<PocoUser>() 31builder.Services.AddSingleton<IUserStore<PocoUser>, InMemoryUserStore<PocoUser>>(); 32builder.Services.AddSingleton<IUserPasskeyStore<PocoUser>, InMemoryUserStore<PocoUser>>();
IdentitySample.PasskeyUI (8)
Program.cs (8)
12builder.Services.AddRazorComponents(); 13builder.Services.AddCascadingAuthenticationState(); 15builder.Services.AddAuthentication(options => 22builder.Services.ConfigureApplicationCookie(options => 31builder.Services.AddAuthorization(); 33builder.Services.AddIdentityCore<PocoUser>() 37builder.Services.AddSingleton<IUserStore<PocoUser>, InMemoryUserStore<PocoUser>>(); 38builder.Services.AddSingleton<IUserPasskeyStore<PocoUser>, InMemoryUserStore<PocoUser>>();
Keycloak.ApiService (3)
Program.cs (3)
7builder.Services.AddProblemDetails(); 9builder.Services.AddAuthentication() 16builder.Services.AddAuthorizationBuilder();
Keycloak.Web (6)
Program.cs (6)
14builder.Services.AddRazorComponents() 17builder.Services.AddOutputCache(); 19builder.Services.AddHttpContextAccessor() 22builder.Services.AddHttpClient<WeatherApiClient>(client => 32builder.Services.AddAuthentication(oidcScheme) 45builder.Services.AddCascadingAuthenticationState();
Microsoft.AspNetCore (2)
WebApplicationBuilder.cs (2)
215Host = new ConfigureHostBuilder(bootstrapHostBuilder.Context, Configuration, Services); 216WebHost = new ConfigureWebHostBuilder(webHostContext, Configuration, Services);
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (3)
UserJwtsTests.cs (3)
87builder.Services.AddRouting(); 88builder.Services.AddAuthentication().AddJwtBearer(); 89builder.Services.AddAuthorization();
Microsoft.AspNetCore.Authentication.Test (3)
AuthenticationMiddlewareTests.cs (3)
165builder.Services.AddAuthorization(); 166builder.Services.AddAuthentication().AddJwtBearer(); 188builder.Services.AddAuthentication().AddJwtBearer();
Microsoft.AspNetCore.Authorization.Test (2)
AuthorizationMiddlewareTests.cs (2)
981builder.Services.AddAuthorization(); 982builder.Services.AddScoped<IAuthorizationHandler, TestAuthorizationHandler>();
Microsoft.AspNetCore.Diagnostics.Tests (1)
ExceptionHandlerTest.cs (1)
884builder.Services.AddExceptionHandler(o => o.ExceptionHandlingPath = "/handle-errors");
Microsoft.AspNetCore.Identity.FunctionalTests (4)
MapIdentityApiTests.cs (4)
1286builder.Services.AddSingleton(LoggerFactory); 1287builder.Services.AddAuthorization(); 1291builder.Services.AddSingleton(_ => dbConnection); 1294configureServices(builder.Services);
Microsoft.AspNetCore.Mvc.FunctionalTests (12)
AntiforgeryMiddlewareTest.cs (12)
26builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestController)); 27builder.Services.AddAntiforgery(); 58builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestWithBothAttributesController)).AddViews(); 59builder.Services.AddAntiforgery(); 72builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestController)).AddViews(); 73builder.Services.AddAntiforgery(); 99builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestController)); 100builder.Services.AddAntiforgery(); 142builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestController)).AddViews(); 143builder.Services.AddAntiforgery(); 174builder.Services.AddMvcCore().UseSpecificControllers(typeof(TestWithRequestSizeLimitController)); 175builder.Services.AddAntiforgery();
Microsoft.AspNetCore.OpenApi (4)
Extensions\OpenApiServiceCollectionExtensions.cs (4)
25/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 46/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 81/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 99/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/>
Microsoft.AspNetCore.Rewrite.Tests (5)
MiddlewareTests.cs (5)
884builder.Services.Configure<RewriteOptions>(options => 920builder.Services.Configure<RewriteOptions>(options => 956builder.Services.Configure<RewriteOptions>(options => 993builder.Services.Configure<RewriteOptions>(options => 1030builder.Services.Configure<RewriteOptions>(options =>
Microsoft.AspNetCore.Tests (68)
WebApplicationTests.cs (68)
54builder.Services.AddRoutingCore(); 84builder.Services.AddRoutingCore(); 114builder.Services.AddRoutingCore(); 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()); 293builder.Services.AddSingleton<IHostedService>(hostedService); 294builder.Services.AddSingleton<IServer>(server); 352builder.Services.AddSingleton<IServer>(new MockAddressesServer()); 363builder.Services.AddSingleton<IServer>(new MockAddressesServer(new List<string>().AsReadOnly())); 1388var sp = builder.Services.BuildServiceProvider(); 1404builder.Services.AddSingleton<IConfiguration>(builder.Configuration); 1405var sp = builder.Services.BuildServiceProvider(); 1476builder.Services.AddSingleton(builder.Services); 1506builder.Services.AddSingleton(builder.Services); 1533using (var serviceProvider = builder.Services.BuildServiceProvider()) 1552builder.Services.AddSingleton(builder.Services); 1556builder.Services.AddSingleton<IHostLifetime, CustomHostLifetime>(); 1668builder.Services.AddSingleton<IStartupFilter, TerminalMiddlewareStartupFilter>(); 1690builder.Services.AddSingleton<IStartupFilter, UseRoutingStartupFilter>(); 1755Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IConfigureOptions<LoggerFactoryOptions>))); 1757Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment))); 1758Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IOptionsChangeTokenSource<HostFilteringOptions>))); 1759Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer))); 1760Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(EndpointDataSource))); 1775Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IConfigureOptions<LoggerFactoryOptions>)); 1776Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IOptionsChangeTokenSource<HostFilteringOptions>)); 1777Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IServer)); 1778Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(EndpointDataSource)); 1781Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment))); 1791builder.Services.AddScoped<Service>(); 1792builder.Services.AddSingleton<Service2>(); 1805builder.Services.AddScoped<Service>(); 1806builder.Services.AddSingleton<Service2>(); 1819Assert.Throws<InvalidOperationException>(() => builder.Services.AddSingleton<IService>(new Service())); 1820Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddSingleton(new Service())); 1821Assert.Throws<InvalidOperationException>(() => builder.Services.AddScoped<IService, Service>()); 1822Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddScoped<IService, Service>()); 1823Assert.Throws<InvalidOperationException>(() => builder.Services.Remove(ServiceDescriptor.Singleton(new Service()))); 1824Assert.Throws<InvalidOperationException>(() => builder.Services[0] = ServiceDescriptor.Singleton(new Service())); 2017builder.Services.AddSingleton<IStartupFilter, PropertyFilter>(); 2053builder.Services.AddSingleton<IStartupFilter, ThrowingStartupFilter>(); 2423Assert.Contains(builder.Services, service => service.ServiceType == typeof(HostBuilderContext)); 2424Assert.Contains(builder.Services, service => service.ServiceType == typeof(IHostApplicationLifetime)); 2425Assert.Contains(builder.Services, service => service.ServiceType == typeof(IHostLifetime)); 2426Assert.Contains(builder.Services, service => service.ServiceType == typeof(IOptions<>)); 2427Assert.Contains(builder.Services, service => service.ServiceType == typeof(ILoggerFactory)); 2428Assert.Contains(builder.Services, service => service.ServiceType == typeof(ILogger<>)); 2441builder.Services.AddAuthorization(); 2442builder.Services.AddAuthentication("testSchemeName") 2481builder.Services.AddAuthorization(); 2482builder.Services.AddAuthentication("testSchemeName") 2527Assert.Same(builder.Services, iHostApplicationBuilder.Services); 2619builder.Services.AddRouting(); 2646builder.Services.AddRoutingCore().Configure<RouteOptions>(options => 2683builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2714builder.Services.AddSingleton<IDebugger>(new TestDebugger(false)); 2735builder.Services.AddAuthenticationCore(); 2736builder.Services.AddAuthorization(); 2737builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2763builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2780builder.Services.AddSingleton<IDebugger>(new TestDebugger(true));
MilvusPlayground.ApiService (1)
Program.cs (1)
11builder.Services.AddProblemDetails();
MinimalFormSample (1)
Program.cs (1)
10builder.Services.AddAntiforgery();
MinimalJwtBearerSample (2)
Program.cs (2)
8builder.Services.AddAuthentication() 13builder.Services.AddAuthorization(options =>
MinimalOpenIdConnectSample (2)
Program.cs (2)
7builder.Services 11builder.Services.AddAuthorization();
MinimalValidationSample (1)
Program.cs (1)
9builder.Services.AddValidation();
MvcFormSample (1)
Program.cs (1)
7builder.Services.AddControllersWithViews();
MyFrontend (4)
Program.cs (4)
9builder.Services.AddHttpForwarderWithServiceDiscovery(); 11builder.Services.AddHttpClient<CatalogServiceClient>(c => c.BaseAddress = new("https+http://catalogservice")); 15builder.Services.AddSingleton<BasketServiceClient>() 18builder.Services.AddRazorComponents();
MySql.ApiService (1)
Program.cs (1)
13builder.Services.AddProblemDetails();
Nats.Backend (1)
Program.cs (1)
14builder.Services.AddHostedService<AppEventsBackendService>();
OpenAIEndToEnd.WebStory (1)
Program.cs (1)
13builder.Services.AddRazorComponents()
OutputCachingSample (1)
Startup.cs (1)
9builder.Services.AddOutputCache(options =>
Publishers.Frontend (2)
Program.cs (2)
9builder.Services.AddHttpClient<ApiClient>(c => c.BaseAddress = new("http://api")); 12builder.Services.AddRazorComponents()
Qdrant.ApiService (1)
Program.cs (1)
10builder.Services.AddProblemDetails();
RateLimitingSample (4)
Program.cs (4)
14builder.Services.AddDbContext<TodoDb>(opt => opt.UseInMemoryDatabase("TodoList")); 15builder.Services.AddDatabaseDeveloperPageExceptionFilter(); 17builder.Services.AddLogging(); 23builder.Services.AddRateLimiter(options =>
Sample (11)
Program.cs (11)
11builder.Services.AddControllers(); 13builder.Services.AddAuthentication().AddJwtBearer(); 17builder.Services.ConfigureHttpJsonOptions(options => 22builder.Services.AddOpenApi("v1", options => 27builder.Services.AddOpenApi("v2", options => 38builder.Services.AddOpenApi("controllers"); 39builder.Services.AddOpenApi("responses"); 40builder.Services.AddOpenApi("forms"); 41builder.Services.AddOpenApi("schemas-by-ref"); 42builder.Services.AddOpenApi("xml"); 43builder.Services.AddOpenApi("localized", options =>
SignalRServerlessWeb (2)
Program.cs (2)
8builder.Services.AddRazorPages(); 18builder.Services.AddHostedService(sp => new PeriodicBroadcaster(hubContext));
SignalRWeb (2)
Program.cs (2)
4builder.Services.AddRazorPages(); 5builder.Services.AddSignalR().AddNamedAzureSignalR("signalrDefault");
SimpleWebSiteWithWebApplicationBuilder (2)
Program.cs (2)
10builder.Services.AddControllers(); 11builder.Services.AddAntiforgery();
Stress.ApiService (2)
Program.cs (2)
19builder.Services.AddOpenTelemetry() 33builder.Services.AddSingleton<TestMetrics>();
TestProject.IntegrationServiceA (1)
Program.cs (1)
27builder.Services.AddHealthChecks();
WaitFor.Frontend (2)
Program.cs (2)
9builder.Services.AddHttpClient<ApiClient>(c => c.BaseAddress = new("http://api")); 12builder.Services.AddRazorComponents()
WebFrontEnd (4)
Program.cs (4)
10builder.Services.AddHttpClient("gateway", client => client.BaseAddress = new Uri("https+http://gateway")); 12builder.Services.AddHttpClient("nuget", client => client.BaseAddress = new Uri("https://nuget")); 14builder.Services.AddHttpClient("external-service", client => 22builder.Services.AddRazorComponents()
WebPubSubWeb (2)
Program.cs (2)
9builder.Services.AddHostedService<NotificationService>(); 12builder.Services.AddRazorPages();