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.
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.