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
/// <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;
}