ASP.NET Core Interview

Testing, Deployment & Hosting

ASP.NET Core interview questions covering testing, deployment & hosting.

25 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

25 Results
201
SeniorAdvanced

What is unit testing in ASP.NET Core applications?

Unit testing verifies a small unit of application behavior in isolation, typically a method or class. Dependencies such as repositories, external APIs, clocks, or message senders are replaced with fakes, stubs, or mocks when appropriate.

202
SeniorAdvanced

What is integration testing in ASP.NET Core?

Integration testing verifies that multiple application components work together. In ASP.NET Core, an integration test can start a test host and send real HTTP requests through routing, middleware, filters, controllers, serialization, and configured services.

203
SeniorAdvanced

What is WebApplicationFactory<TEntryPoint>?

WebApplicationFactory<TEntryPoint> is a testing utility from Microsoft.AspNetCore.Mvc.Testing that creates an ASP.NET Core application host for functional and integration tests.

204
SeniorAdvanced

How can dependencies be replaced in ASP.NET Core integration tests?

Integration tests often need test-specific implementations for external systems or infrastructure. WebApplicationFactory can customize the application's service collection before the test host starts.

205
SeniorAdvanced

What is mocking and when should it be used?

Mocking uses a test double that can provide controlled behavior and, when useful, verify interactions with a dependency.

206
SeniorAdvanced

What should be tested in an ASP.NET Core controller?

Controller tests should focus on controller responsibilities: interpreting input, invoking application services, and selecting the correct HTTP or MVC result.

207
SeniorAdvanced

How should database code be tested?

The test strategy depends on what is being verified. Pure business logic should not require a database. Repository or EF Core behavior may require integration tests against a database engine with behavior close to production.

208
SeniorAdvanced

What is the ASP.NET Core environment and how is it used during testing?

ASP.NET Core environments allow behavior and configuration to vary between environments such as Development, Staging, Production, and a custom Testing environment.

209
SeniorAdvanced

What is application publishing in ASP.NET Core?

Publishing prepares an ASP.NET Core application for deployment. The publish process compiles the application and produces the assemblies, configuration files, static assets, runtime metadata, and other files required by the chosen deployment model.

210
SeniorAdvanced

What is the difference between framework-dependent and self-contained deployment?

A framework-dependent deployment relies on a compatible .NET runtime being installed on the target environment. The published application is usually smaller and can use the centrally installed runtime.

211
SeniorAdvanced

What is Kestrel and what role does it play in production hosting?

Kestrel is the cross-platform web server used by ASP.NET Core. It accepts HTTP connections and hosts the application's ASP.NET Core request pipeline.

212
SeniorAdvanced

What is a reverse proxy and why is it used with ASP.NET Core?

A reverse proxy receives client traffic and forwards it to one or more backend application servers. Examples of reverse-proxy roles include TLS termination, load balancing, host/path routing, request limits, compression, caching, and integration with a hosting platform.

213
SeniorAdvanced

What is IIS in-process hosting for ASP.NET Core?

With IIS in-process hosting, the ASP.NET Core application runs inside the IIS worker process using the ASP.NET Core Module integration model.

214
SeniorAdvanced

What is IIS out-of-process hosting for ASP.NET Core?

With IIS out-of-process hosting, the ASP.NET Core application runs in a separate process using Kestrel, while the ASP.NET Core Module in IIS forwards requests to that process.

215
SeniorAdvanced

What is web.config used for when hosting ASP.NET Core behind IIS?

For an ASP.NET Core application hosted with IIS, web.config configures the ASP.NET Core Module and relevant IIS behavior. It can specify how the application process is started, hosting model, arguments, and diagnostic stdout logging settings.

216
SeniorAdvanced

How is ASP.NET Core hosted as a Windows Service?

An ASP.NET Core application can run as a Windows Service when it needs to operate without an interactive user session and be managed by the Windows Service Control Manager.

217
SeniorAdvanced

How can ASP.NET Core applications run in containers?

ASP.NET Core applications can be packaged into container images containing the application and the runtime environment required by the selected deployment approach.

218
SeniorAdvanced

What is CI/CD for an ASP.NET Core application?

Continuous Integration (CI) automatically validates changes by restoring dependencies, building the solution, and running tests. Continuous Delivery or Deployment extends the pipeline to produce versioned artifacts and move them through deployment environments.

219
SeniorAdvanced

How should configuration differ between development and production?

Configuration should vary by environment without changing application code. Development may use local databases, verbose diagnostics, developer exception pages, and local secret storage. Production normally uses protected secrets, controlled log levels, production endpoints, HTTPS, and safe error handling.

220
SeniorAdvanced

How should database migrations be handled during deployment?

Database schema changes must be coordinated with application deployment. EF Core migrations provide a versioned representation of schema changes, but the method used to apply them should match the production operating model.

221
SeniorAdvanced

What are health checks used for during deployment?

Health checks help deployment infrastructure determine whether an application instance is alive and ready to receive traffic.

222
SeniorAdvanced

What is a rolling deployment?

A rolling deployment replaces application instances gradually rather than stopping every old instance and starting every new instance at once.

223
SeniorAdvanced

What is a blue-green deployment?

Blue-green deployment maintains two separate production-capable environments. One environment serves live traffic while the other receives the new release and is validated.

224
SeniorAdvanced

What should be considered when deploying ASP.NET Core behind a load balancer?

Multiple application instances should avoid keeping critical shared state only in local memory. Shared sessions, caches, files, and job coordination may require external stores or an architecture that removes the need for shared mutable state.

225
SeniorAdvanced

What are best practices for testing, deployment, and hosting ASP.NET Core applications?

Use layered testing: fast unit tests for isolated behavior and integration tests for critical framework and infrastructure paths. Keep tests deterministic and use production-like infrastructure where provider-specific behavior matters.