Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffolding Identity UI. #1093

Open
Ayush2395 opened this issue Jan 16, 2024 · 3 comments
Open

Scaffolding Identity UI. #1093

Ayush2395 opened this issue Jan 16, 2024 · 3 comments

Comments

@Ayush2395
Copy link

Bug description
In the previous version in .NET 7, I can easily scaffold the Identity UI for customizing the UI of Login, Register, etc., But in the current release for .NET 8, its not working, its giving the error, screenshot is attached down below:

Error screenshot:

scaffold error

I tried to remove the files and other stuffs to reduce the error, but still, I get error on the AddWebService Extension method, but it reduces the errors to one, because of this extension method, I changed the namespace too, but still that error is annoying me 😂.

The error is only occurred in this .NET 8.

Please fix that my project is on hold because of that, or any idea how I can erase that error from this world 😂.

@rlyon1
Copy link

rlyon1 commented Feb 2, 2024

I had/have the same issue trying to scaffold the Login page. I ended having to do the following to get the scaffold to apply:

  1. Comment out every line of offending code (it was iterative)
  2. Comment out the Nswag post build event in Web.csproj

Once the item was scaffolded I reverted the changes with the following notes:

  1. It still created it's own ApplicationDbContext even though I selected one.
  2. It added some lines in Program.cs of Web project that weren't required.

In the end, I'm still receiving the following message when using the scaffolded page:
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager-1[Microsoft.AspNetCore.Identity.IdentityUser]' while attempting to activate '<namespace>.Areas.Identity.Pages.Account.LoginModel'. Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ThrowHelperUnableToResolveService(Type type, Type requiredBy)
InvalidOperationException: The exception handler configured on ExceptionHandlerOptions produced a 404 status response. This InvalidOperationException containing the original exception was thrown since this is often due to a misconfigured ExceptionHandlingPath. If the exception handler is expected to return 404 status responses then set AllowStatusCode404Response to true. Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)

@rviveiros
Copy link

Just made it work here.

  1. Try to scaffold then you see this error;
  2. Go to your Directory.Packages.props and check if your using version 8.0.2 for all EntityFrameworkCore packages.
    This one was wrong =>
  3. Don't forget to use ApplicationUser in the scaffold options. The default IdentityUser shouldn't work.
  4. Delete the ApplicationDbContext from Areas/Identity/Data.
  5. Go to Program.cs and revert the changes from scaffold. That is delete the ApplicationDbContext and Identity initialization.

@rlyon1
Copy link

rlyon1 commented Mar 11, 2024

Can confirm it works better in 8.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants