In C# ASP.NET does the order of middleware application matter?
The following 2 code snippets:
public class Startup
{
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
setUpMVCRoutes(app);
app.UseSwaggerUi("foobar/api", "/foobar/v3/api.json");
app.UseSwaggerGen("foobar/{apiVersion}/api.json");
app.UseDefaultFiles();
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
app.UseStaticFiles();
app.UseIdentity();
app.UseCookieAuthentication();
}
...
}
and this
public class Startup
{
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseIdentity();
app.UseCookieAuthentication();
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
app.UseDefaultFiles();
app.UseStaticFiles();
setUpMVCRoutes(app);
app.UseSwaggerGen("foobar/{apiVersion}/api.json");
app.UseSwaggerUi("foobar/api", "/foobar/v3/api.json");
}
...
}
Is there any difference? I imagine that if this middleware works similar to python decorators or just pipe of functions which do something and pass the results to the next function, then it might matter.