# Microservices Architecture (.NET) > Service decomposition, API gateway, service discovery, distributed transactions, resilience patterns, Kubernetes basics (deployments, services, config) - 25 interview questions - Senior - [Interview Questions: .NET](https://sharpskill.dev/en/technologies/dotnet/interview-questions.md) ## 1. What is the Bounded Context pattern in Domain-Driven Design applied to microservices? **Answer** A Bounded Context defines an explicit boundary around a domain model with its own ubiquitous language and database. In microservices architecture, each Bounded Context typically becomes an independent distributed microservice. This ensures data autonomy and prevents model sharing between services. For example, the User entity in the Profile context can share the ID with the Buyer entity in the Ordering context, but they remain distinct models with their own attributes and business logic. ## 2. What is the main role of an API Gateway in a microservices architecture? **Answer** An API Gateway serves as a single entry point for groups of microservices, acting as a reverse proxy that routes client requests to appropriate services. It implements the Backend for Frontend (BFF) pattern and handles cross-cutting concerns like authentication, SSL termination, caching, and response aggregation. This simplifies client-to-microservice communication by avoiding multiple direct calls and centralizing routing logic. ## 3. How does service discovery work in Docker Compose? **Answer** Docker Compose uses internal DNS for service discovery. Each service defined in docker-compose.yml is accessible by its service name as hostname. For example, if a Redis service is named 'basketdata', other services can connect to it via ConnectionString=basketdata. Docker automatically resolves this name to the container's internal IP address on the shared Docker network, eliminating the need to hardcode IP addresses. ## 22 more questions available - What is the principle of the Circuit Breaker pattern with Polly in .NET? - How to configure a retry policy with Polly for HttpClient in .NET? Sign up for free: https://sharpskill.dev/en/login ## Other .NET interview topics - [C# Basics](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-basics.md): 25 questions, Junior - [LINQ & Delegates](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-linq-delegates.md): 20 questions, Junior - [C# Language Essentials](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-language-essentials.md): 15 questions, Junior - [ASP.NET Core Fundamentals](https://sharpskill.dev/en/technologies/dotnet/interview-questions/aspnet-core-fundamentals.md): 18 questions, Junior - [ASP.NET Core Request Lifecycle](https://sharpskill.dev/en/technologies/dotnet/interview-questions/aspnet-core-request-lifecycle.md): 20 questions, Junior - [Configuration & Settings](https://sharpskill.dev/en/technologies/dotnet/interview-questions/configuration-settings.md): 20 questions, Junior - [Application Lifecycle](https://sharpskill.dev/en/technologies/dotnet/interview-questions/application-lifecycle.md): 20 questions, Junior - [Dependency Injection](https://sharpskill.dev/en/technologies/dotnet/interview-questions/dependency-injection.md): 24 questions, Mid-Level - [Entity Framework Core](https://sharpskill.dev/en/technologies/dotnet/interview-questions/entity-framework-core.md): 25 questions, Mid-Level - [Minimal APIs](https://sharpskill.dev/en/technologies/dotnet/interview-questions/minimal-apis.md): 18 questions, Mid-Level - [Web API Development](https://sharpskill.dev/en/technologies/dotnet/interview-questions/web-api-development.md): 22 questions, Mid-Level - [Async in ASP.NET Core](https://sharpskill.dev/en/technologies/dotnet/interview-questions/async-aspnet-core.md): 20 questions, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/authentication-authorization.md): 18 questions, Mid-Level - [HttpClient & Networking](https://sharpskill.dev/en/technologies/dotnet/interview-questions/httpclient-networking.md): 20 questions, Mid-Level - [JSON Serialization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/json-serialization.md): 20 questions, Mid-Level - [Entity Framework Core Advanced](https://sharpskill.dev/en/technologies/dotnet/interview-questions/ef-core-advanced.md): 25 questions, Mid-Level - [C# Advanced Features](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-advanced-features.md): 20 questions, Mid-Level - [Clean Architecture](https://sharpskill.dev/en/technologies/dotnet/interview-questions/clean-architecture.md): 20 questions, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/en/technologies/dotnet/interview-questions/logging-monitoring.md): 22 questions, Mid-Level - [Unit Testing & xUnit](https://sharpskill.dev/en/technologies/dotnet/interview-questions/unit-testing-xunit.md): 20 questions, Mid-Level - [Integration Testing](https://sharpskill.dev/en/technologies/dotnet/interview-questions/integration-testing.md): 18 questions, Mid-Level - [Docker & Containerization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/docker-containerization.md): 16 questions, Mid-Level - [NuGet Package Management](https://sharpskill.dev/en/technologies/dotnet/interview-questions/nuget-package-management.md): 16 questions, Mid-Level - [Memory Management & GC](https://sharpskill.dev/en/technologies/dotnet/interview-questions/memory-management-gc.md): 22 questions, Senior - [Reactive Programming](https://sharpskill.dev/en/technologies/dotnet/interview-questions/reactive-programming.md): 24 questions, Senior - [Async/await & Patterns](https://sharpskill.dev/en/technologies/dotnet/interview-questions/async-await-patterns.md): 26 questions, Senior - [.NET Design Patterns](https://sharpskill.dev/en/technologies/dotnet/interview-questions/dotnet-design-patterns.md): 24 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/performance-optimization.md): 22 questions, Senior - [Security & Best Practices](https://sharpskill.dev/en/technologies/dotnet/interview-questions/security-best-practices.md): 24 questions, Senior - [SignalR & Real-time](https://sharpskill.dev/en/technologies/dotnet/interview-questions/signalr-realtime.md): 22 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/dotnet/interview-questions/microservices-architecture