MicrosoftIdentity/Account/SignedOut show as 404

Answer from Google Bard

The error 404 means that the page "MicrosoftIdentity/Account/SignedOut" cannot be found. This can happen for a few reasons:

  • The page does not exist.
  • The page is not accessible to the user.
  • There is a problem with the routing configuration.

To fix this error, you need to check the following:

  • Make sure that the page "MicrosoftIdentity/Account/SignedOut" exists.
  • Make sure that the user has permission to access the page.
  • Check the routing configuration to make sure that the page is accessible.

If you are still getting the error 404, you can try the following:

  • Clear the browser cache and cookies.
  • Try a different browser.
  • Contact the site administrator for help.

Here are some specific solutions that have worked for other people:

  • If you are using the Microsoft.AspNetCore.Authentication.AzureAD.UI package, you can fix the error by adding the [AllowAnonymous] attribute to the SignOut action in the AccountController.
  • If you are using the Microsoft Identity package, you can fix the error by adding the endpoints.MapRazorPages(); method to the Configure method in Startup.cs.

 

add the missing endpoints.MapRazorPages() in startup.cs works for me

 

https://nuget.info/packages/Microsoft.AspNetCore.App.Ref/3.1.10

This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/e3187077455f953200e3c930430808a30f48b82e

https://github.com/dotnet/aspnetcore/blob/e3187077455f953200e3c930430808a30f48b82e/src/Mvc/Mvc.RazorPages/src/Builder/RazorPagesEndpointRouteBuilderExtensions.cs#L25

/// <summary>
        /// Adds endpoints for Razor Pages to the <see cref="IEndpointRouteBuilder"/>.
        /// </summary>
        /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
        /// <returns>An <see cref="PageActionEndpointConventionBuilder"/> for endpoints associated with Razor Pages.</returns>
        public static PageActionEndpointConventionBuilder MapRazorPages(this IEndpointRouteBuilder endpoints)
        {
            if (endpoints == null)
            {
                throw new ArgumentNullException(nameof(endpoints));
            }

            EnsureRazorPagesServices(endpoints);

            return GetOrCreateDataSource(endpoints).DefaultBuilder;
        }

private static void EnsureRazorPagesServices(IEndpointRouteBuilder endpoints)
        {
            var marker = endpoints.ServiceProvider.GetService<PageActionEndpointDataSource>();
            if (marker == null)
            {
                throw new InvalidOperationException(Mvc.Core.Resources.FormatUnableToFindServices(
                    nameof(IServiceCollection),
                    "AddRazorPages",
                    "ConfigureServices(...)"));
            }
        }

 private static PageActionEndpointDataSource GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
        {
            var dataSource = endpoints.DataSources.OfType<PageActionEndpointDataSource>().FirstOrDefault();
            if (dataSource == null)
            {
                dataSource = endpoints.ServiceProvider.GetRequiredService<PageActionEndpointDataSource>();
                endpoints.DataSources.Add(dataSource);
            }

            return dataSource;
        }

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-09-04 14个基本初等函数的导数 高等数学,微积分,原函数
2021-09-04 Trouble Connecting to sql server Login failed. "The login is from an untrusted domain and cannot be used with Windows authentication"
2017-09-04 invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
2017-09-04 学习JavaScript
2015-09-04 查找2个分支的共同父节点
点击右上角即可分享
微信分享提示