The way to run some logic for each request in ASP.NET 5 is through Middlewares. Here is an example of middleware:
public class FooMiddleware { private readonly RequestDelegate _next; public FooMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) {
You can then register this in your Startup class:
public class Startup { public void Configure(IApplicationBuilder app) { app.UseMiddleware<FooMiddleware>(); } }
See here for more information on Middlewares in ASP.NET 5 .
For any entry-level launch invocation calls, see the application launch documentation .
source share