MySqlException: Table 'searchhome.aspnetusers' doesn't exist
So I wanted to do the following: I have already created a simple database with a table. On that db table some values have been added. I wanted to display that added value on my simple ASP.NET Core app. However, the dotnet run gave me the error as per screenshot attached
(aspnetusers does not exist)
The dotnet ef database update
leads to the same error (aspnetusers does not exist). I have tried adding that aspnetuser table or tried updating the database( INSERT INTO
__EFMigrationsHistory (
MigrationId,
ProductVersion) VALUES ('00000000000000_CreateIdentitySchema', '7.0.2');
)
None of these helped me out.
All my codes are here https://pastebin.com/kdgjhGTu
Could anyone kindly point me in the right direction??Pastebin
//Controller Classusing System.Diagnostics;using Microsoft.AspNetCo...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
8 Replies
Since you are using Identity, you don't need to make the Users table yourself in the db . So remove the DBSet line in the ApplicationContext. And make sure Identity is properly configured.
Secondly Add Migration
And then
These commands should be executed in the Package Manager Console.
And to display users follow this article:
https://csharp-video-tutorials.blogspot.com/2019/07/list-all-users-from-aspnet-core.html?m=1
List all users from asp.net core identity database
Free C#, .NET and SQL Server Video Tutorials for beginners and intermediate programmers.
Follow all the guidelines above and then let me know
Thank you so much for the guideline -- just a quick question. Since I am on Rider, it doesn't seem to have the Package Manager Console (it's only for Visual Studio, right?)
In that case I can use "dotnet ef database update " after I added the initial migration, right?
Right, you can use those dotnet cli commands
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
You are right, I actually didn't know the exact cli commands so didn't bother to Google
But noted
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View