Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mahender Singh 39 posts 171 karma points
    Jul 04, 2022 @ 14:37
    Mahender Singh
    0

    AuthorizationPolicy named: 'UmbracoFeatureEnabled' was not found

    Hi Team,

    I am creating Core 6 web api project for Umbraco 9.5 version. I create one api class which is

    [Route("api/StoreLocator")]
    [ApiController]
    public class StoreLocatorController : UmbracoApiController
    {
    

    now i added some default settings in start.up class file which is

     services
                     .AddSwaggerGen()
                     .AddUmbraco(_env, _config)
                     .AddBackOffice()
                     .AddWebsite()
                     .AddComposers().Build();
    
     app.UseUmbraco()
                    .WithMiddleware(u =>
                    {
                        u.UseBackOffice();
                        u.UseWebsite();
                        u.UseUmbracoCoreMiddleware();
                    })
                    .WithEndpoints(u =>
                    {
                        u.UseInstallerEndpoints();
                        u.UseBackOfficeEndpoints();
                        u.UseWebsiteEndpoints();
                    });
    

    when i run this web api project and try to call api...i am getting the error response which is

    System.InvalidOperationException: The AuthorizationPolicy named: 'UmbracoFeatureEnabled' was not found.
       at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider policyProvider, IEnumerable`1 authorizeData)
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
       at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
       at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
       at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
    

    Could anyone please help me on this issue.

Please Sign in or register to post replies

Write your reply to:

Draft