Reputation: 82507
I have the following code in my Configure
method that is giving a warning:
It says:
The call to UseAuthorization should appear between app.UseRouting() and app.UseEndpoints(..) for authorization to be correctly evaluated.
It clearly is between those calls. I would assume that it is mistaken and move on, but when I call my service operations I get this error:
The code will not run because it thinks that my UseAuthorization
is not between UseRouting
and UseEndpoints
.
I am stumped! Not sure what I need to change to make this work. Any advice on what I am missing would be appreciated.
Upvotes: 2
Views: 781
Reputation: 82507
Turns out that higher up in the Configure
method I had this:
app.UseMiniProfiler()
.UseStaticFiles()
.UseRouting()
.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
I ignored it because I thought it was all configuration for UseMiniProfiler
, but it was actually chaining off the app
to call UseRouting
and UseEndpoints
right in a row!
Removing those calls fixed it!
Upvotes: 4