Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimit…
How to Enable Application Insights? Answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on["APPINSIGHTS_INSTRUMENTATIONKEY…
How to Use Moq for Mocking Dependencies? Answer: Moq creates fake implementations of interfaces to control behavior during tests. Example: var mockRepo = new Mock<IProductRepository>(); mockRepo.Setup(x => x.Get…
ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC
Rate Limiting Middleware in .NET 8
builder.Services.AddRateLimiter(options =>
{
options.GlobalLimiter =
PartitionedRateLimiter.Create<HttpContext, string>(httpContext =>
RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo
teIpAddress?.ToString()!, _ =>
new FixedWindowRateLimiterOptions
{
PermitLimit = 10,
Window = TimeSpan.FromMinutes(1),
QueueLimit = 2
}));
});
app.UseRateLimiter();
✅ Helps protect APIs from abuse or DoS attacks.
ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC
How to Enable Application Insights?
Answer:
Application Insights provides monitoring, telemetry, and tracing.
Setup:
builder.Services.AddApplicationInsightsTelemetry(builder.Configurati
on["APPINSIGHTS_INSTRUMENTATIONKEY"]);
Features:
ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC
How to Use Moq for Mocking Dependencies?
Answer:
Moq creates fake implementations of interfaces to control behavior during tests.
Example:
var mockRepo = new Mock<IProductRepository>();
mockRepo.Setup(x => x.GetAll()).Returns(new List<Product> { new
Product { Id = 1, Name = "Laptop" } });
var service = new ProductService(mockRepo.Object);
var products = service.GetAll();
Assert.Single(products);
✅ Use .Setup(), .Verify(), and .Returns() to simulate behavior.