C
C#2mo ago
morry329#

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
Salman
Salman2mo ago
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
Add Migration Initial
Add Migration Initial
And then
Update Database
Update Database
These commands should be executed in the Package Manager Console.
Salman
Salman2mo ago
List all users from asp.net core identity database
Free C#, .NET and SQL Server Video Tutorials for beginners and intermediate programmers.
Salman
Salman2mo ago
Follow all the guidelines above and then let me know
morry329#
morry329#2mo ago
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?
Salman
Salman2mo ago
Right, you can use those dotnet cli commands
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Salman
Salman2mo ago
You are right, I actually didn't know the exact cli commands so didn't bother to Google But noted
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server