Implemented interface member:
property
Services
Microsoft.Extensions.Hosting.IHostApplicationBuilder.Services
226 references to Services
ApiGateway (1)
Program.cs (1)
4builder.Services.AddReverseProxy()
Aspire.Dashboard (34)
DashboardWebApplication.cs (34)
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 => 210builder.Services.AddCors(options => 234builder.Services.TryAddScoped<IDashboardClient, DashboardClient>(); 235builder.Services.TryAddSingleton<IDashboardClientStatus, DashboardClientStatus>(); 238builder.Services.AddGrpc(); 239builder.Services.AddSingleton<TelemetryRepository>(); 240builder.Services.AddTransient<StructuredLogsViewModel>(); 242builder.Services.AddTransient<OtlpLogsService>(); 243builder.Services.AddTransient<OtlpTraceService>(); 244builder.Services.AddTransient<OtlpMetricsService>(); 246builder.Services.AddTransient<TracesViewModel>(); 247builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IOutgoingPeerResolver, ResourceOutgoingPeerResolver>()); 248builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IOutgoingPeerResolver, BrowserLinkOutgoingPeerResolver>()); 250builder.Services.AddFluentUIComponents(); 252builder.Services.AddScoped<IThemeResolver, BrowserThemeResolver>(); 253builder.Services.AddScoped<ThemeManager>(); 255builder.Services.AddScoped<ShortcutManager>(); 256builder.Services.AddSingleton<IInstrumentUnitResolver, DefaultInstrumentUnitResolver>(); 259builder.Services.AddScoped<BrowserTimeProvider>(); 260builder.Services.AddScoped<ILocalStorage, LocalBrowserStorage>(); 261builder.Services.AddScoped<ISessionStorage, SessionBrowserStorage>(); 263builder.Services.AddScoped<IKnownPropertyLookup, KnownPropertyLookup>(); 265builder.Services.AddScoped<DimensionManager>(); 267builder.Services.AddLocalization(); 269builder.Services.AddAntiforgery(options => 672var authentication = builder.Services 799builder.Services.AddAuthorization(options =>
Aspire.Dashboard.Tests (7)
Integration\DashboardClientAuthTests.cs (3)
78serverAppBuilder.Services.AddGrpc(options => options.EnableDetailedErrors = true); 79serverAppBuilder.Services.AddSingleton(testCalls); 80serverAppBuilder.Services.AddSingleton(loggerFactory);
Integration\IntegrationTestHelpers.cs (2)
82builder.Services.PostConfigure<LoggerFilterOptions>(o => 99builder.Services.AddSingleton(loggerFactory);
Integration\Playwright\Infrastructure\DashboardServerFixture.cs (2)
60builder.Services.AddSingleton<IDashboardClientStatus, MockDashboardClientStatus>(); 61builder.Services.AddScoped<IDashboardClient, MockDashboardClient>();
Aspire.Hosting (14)
Dashboard\DashboardServiceHost.cs (14)
76builder.Services.AddSingleton(configuration); 79builder.Services.AddOptions<ResourceServiceOptions>() 82builder.Services.AddSingleton<IValidateOptions<ResourceServiceOptions>, ValidateResourceServiceOptions>(); 85builder.Services 95builder.Services 105builder.Services.AddSingleton(loggerFactory); 106builder.Services.AddSingleton(loggerOptions); 107builder.Services.Add(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>))); 109builder.Services.AddGrpc(); 110builder.Services.AddSingleton(applicationModel); 111builder.Services.AddSingleton(commandExecutor); 112builder.Services.AddSingleton<DashboardServiceData>(); 113builder.Services.AddSingleton(resourceNotificationService); 114builder.Services.AddSingleton(resourceLoggerService);
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)
8builder.Services.AddOpenTelemetry() 11builder.Services.AddSingleton<CatalogDbInitializer>(); 12builder.Services.AddHostedService(sp => sp.GetRequiredService<CatalogDbInitializer>()); 13builder.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
DaprServiceA (1)
Program.cs (1)
12builder.Services.AddDaprClient();
DaprServiceB (1)
Program.cs (1)
11builder.Services.AddDaprClient();
GetDocumentSample (2)
Program.cs (2)
12builder.Services.AddOpenApi(); 13builder.Services.AddOpenApi("internal");
IdentitySample.ApiEndpoints (3)
Program.cs (3)
15builder.Services.AddAuthorization(); 17builder.Services.AddDbContext<ApplicationDbContext>( 19builder.Services.AddIdentityApiEndpoints<IdentityUser>()
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)
213Host = new ConfigureHostBuilder(bootstrapHostBuilder.Context, Configuration, Services); 214WebHost = new ConfigureWebHostBuilder(webHostContext, Configuration, Services);
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)
24/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 45/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 75/// This method is commonly used to add OpenAPI services to the <see cref="WebApplicationBuilder.Services"/> 93/// 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())); 1386var sp = builder.Services.BuildServiceProvider(); 1402builder.Services.AddSingleton<IConfiguration>(builder.Configuration); 1403var sp = builder.Services.BuildServiceProvider(); 1474builder.Services.AddSingleton(builder.Services); 1504builder.Services.AddSingleton(builder.Services); 1531using (var serviceProvider = builder.Services.BuildServiceProvider()) 1550builder.Services.AddSingleton(builder.Services); 1554builder.Services.AddSingleton<IHostLifetime, CustomHostLifetime>(); 1666builder.Services.AddSingleton<IStartupFilter, TerminalMiddlewareStartupFilter>(); 1688builder.Services.AddSingleton<IStartupFilter, UseRoutingStartupFilter>(); 1753Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IConfigureOptions<LoggerFactoryOptions>))); 1755Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment))); 1756Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IOptionsChangeTokenSource<HostFilteringOptions>))); 1757Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer))); 1758Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(EndpointDataSource))); 1773Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IConfigureOptions<LoggerFactoryOptions>)); 1774Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IOptionsChangeTokenSource<HostFilteringOptions>)); 1775Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(IServer)); 1776Assert.DoesNotContain(builder.Services, descriptor => descriptor.ServiceType == typeof(EndpointDataSource)); 1779Assert.Single(builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment))); 1789builder.Services.AddScoped<Service>(); 1790builder.Services.AddSingleton<Service2>(); 1803builder.Services.AddScoped<Service>(); 1804builder.Services.AddSingleton<Service2>(); 1817Assert.Throws<InvalidOperationException>(() => builder.Services.AddSingleton<IService>(new Service())); 1818Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddSingleton(new Service())); 1819Assert.Throws<InvalidOperationException>(() => builder.Services.AddScoped<IService, Service>()); 1820Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddScoped<IService, Service>()); 1821Assert.Throws<InvalidOperationException>(() => builder.Services.Remove(ServiceDescriptor.Singleton(new Service()))); 1822Assert.Throws<InvalidOperationException>(() => builder.Services[0] = ServiceDescriptor.Singleton(new Service())); 2015builder.Services.AddSingleton<IStartupFilter, PropertyFilter>(); 2051builder.Services.AddSingleton<IStartupFilter, ThrowingStartupFilter>(); 2421Assert.Contains(builder.Services, service => service.ServiceType == typeof(HostBuilderContext)); 2422Assert.Contains(builder.Services, service => service.ServiceType == typeof(IHostApplicationLifetime)); 2423Assert.Contains(builder.Services, service => service.ServiceType == typeof(IHostLifetime)); 2424Assert.Contains(builder.Services, service => service.ServiceType == typeof(IOptions<>)); 2425Assert.Contains(builder.Services, service => service.ServiceType == typeof(ILoggerFactory)); 2426Assert.Contains(builder.Services, service => service.ServiceType == typeof(ILogger<>)); 2439builder.Services.AddAuthorization(); 2440builder.Services.AddAuthentication("testSchemeName") 2479builder.Services.AddAuthorization(); 2480builder.Services.AddAuthentication("testSchemeName") 2525Assert.Same(builder.Services, iHostApplicationBuilder.Services); 2617builder.Services.AddRouting(); 2644builder.Services.AddRoutingCore().Configure<RouteOptions>(options => 2681builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2712builder.Services.AddSingleton<IDebugger>(new TestDebugger(false)); 2733builder.Services.AddAuthenticationCore(); 2734builder.Services.AddAuthorization(); 2735builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2761builder.Services.AddSingleton<IDebugger>(new TestDebugger(true)); 2778builder.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();
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 =>
PostgresEndToEnd.ApiService (1)
Program.cs (1)
19builder.Services.AddDbContextPool<MyDb8Context>(dbContextOptionsBuilder => dbContextOptionsBuilder.UseNpgsql(connectionString));
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 (8)
Program.cs (8)
14builder.Services.AddControllers(); 16builder.Services.AddAuthentication().AddJwtBearer(); 18builder.Services.AddOpenApi("v1", options => 23builder.Services.AddOpenApi("v2", options => { 32builder.Services.AddOpenApi("controllers"); 33builder.Services.AddOpenApi("responses"); 34builder.Services.AddOpenApi("forms"); 35builder.Services.AddOpenApi("schemas-by-ref");
SignalRWeb (2)
Program.cs (2)
4builder.Services.AddRazorPages(); 5builder.Services.AddSignalR().AddNamedAzureSignalR("signalr1");
SimpleWebSiteWithWebApplicationBuilder (2)
Program.cs (2)
10builder.Services.AddControllers(); 11builder.Services.AddAntiforgery();
Stress.ApiService (2)
Program.cs (2)
16builder.Services.AddOpenTelemetry() 19builder.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()
WebPubSubWeb (2)
Program.cs (2)
9builder.Services.AddHostedService<NotificationService>(); 12builder.Services.AddRazorPages();