Top "Asp.net-core-middleware" questions

Questions about Asp.

No service for type has been registered

I am trying to implement ASP.NET Core middleware, and this is the whole code I have in my project: …

c# asp.net-core asp.net-core-middleware
ASP.Net Core exception handling middleware

I am trying to use middleware for exception handling in my ASP.Net Core 3.0 Web API project: public class ErrorHandlingMiddleware { …

c# asp.net-core asp.net-core-webapi asp.net-core-middleware
difference between Map and MapWhen branch in asp.net core Middleware?

When to use Map and MapWhen branch in asp.net core middleware while we are authenticating request. public void Configure(…

asp.net-core asp.net-core-middleware
Read JSON post data in ASP.Net Core MVC

I've tried to find a solution for this, but all the ones coming up are for previous versions of ASP.…

c# asp.net json asp.net-core-webapi asp.net-core-middleware
.Net Core MVC Routing: Setting MapSpaFallbackRoute Conditionally Per Controller

I am developing a project that involves multiple Single Page Applications that are hosted on a single .Net Core 1.0 web …

angular asp.net-core-mvc single-page-application asp.net-core-1.0 asp.net-core-middleware
How to get actual request execution time

Given the following middleware: public class RequestDurationMiddleware { private readonly RequestDelegate _next; private readonly ILogger<RequestDurationMiddleware> _logger; public RequestDurationMiddleware(…

c# asp.net-core stopwatch asp.net-core-middleware
How do I customize ASP.Net Core model binding errors?

I would like to return only standardized error responses from my Web API (Asp.net Core 2.1), but I can't seem …

c# asp.net-core asp.net-core-webapi asp.net-core-middleware
Injecting Service in Middleware in ASP.NET Core

I want to inject a service based on the HTTP header value. So I have 2 classes - DbDataProvider and InMemDataProvider, …

c# asp.net-core dependency-injection asp.net-core-middleware
Access ModelState in Asp.net core Middleware

I need to access ModelState in Asp.net Core 2.1 Middleware, but this is just accessible from Controller. For example I …

c# asp.net-core asp.net-core-middleware .net-core-2.1
ASP.Net Core 2.0 - How to return custom json or xml response from middleware?

In ASP.Net Core 2.0, I am trying to return a message formatted as json or xml with a status code. …

asp.net-core asp.net-core-2.0 asp.net-core-middleware request-pipeline