Skip to content

Exception handler causes a 404 #21510

Closed
Closed
@tango-charly

Description

@tango-charly

Describe the bug

I deployed a website on Azure Webapp with Azure AD, i created the webapp with the command:
dotnet -o webapp -au SingleOrg -clientId [...]

So i got a sample web app with AzureAD Authentication Azure AD Ui in Nuget dependance to handle the user AD Authentication.

In local it works pretty well (y)

But when i deployed with azure devops in Azure Web App, i received a 404 not found for:
/AzureAD/Home/SignIn
Areas:AzureAD Controller:Account Action:SignIn

I have no idea why, i didn't find issues wich solve this problem.

To Reproduce

Create a sample web app and deploy on basic azure Web App (with azure cli)

Appsettings :

{
  "AzureAd": {
    "Instance": "my_instance_url",
    "Domain": "my_domain_url",
    "TenantId": "dummydummy",
    "ClientId": "dummydummy",
    "CallbackPath": "/signin-oidc"
}

Startup.cs > ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
// ...
            services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
                    .AddAzureAD(options => Configuration.Bind("AzureAd", options));

            services.AddControllersWithViews(options =>
            {
                var policy = new AuthorizationPolicyBuilder()
                    .RequireAuthenticatedUser()
                    .Build();
                options.Filters.Add(new AuthorizeFilter(policy));
            });
// ...
}

Startup.cs > Configure

  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
// ...
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "areas",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "Home/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });
// ...
     }

Get 404 response, the Area Azure AD is not found.

Kudu confirm Azure Ad UI Dlls are here :

  • Microsoft.AspNetCore.Authentication.AzureAD.UI.dll - 34kb
  • Microsoft.AspNetCore.Authentication.AzureAD.UI.Views.dll -26kb

Did i miss something or there is an issue about import of area in external package ?

Further technical details

  • ASP.NET Core 3.1
  • Azure Web App (no Authentication configured)

Metadata

Metadata

Assignees

Labels

area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresbreaking-changeThis issue / pr will introduce a breaking change, when resolved / merged.bugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions