During creating my first page i noticed that i could not run dotnet from cmd. I do not know what exactly is a problem. I am sending you a command lines.
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (133ms) [Parameters=[@__normalizedEmail_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [u].[Id], [u].[AccessFailedCount], [u].[ConcurrencyStamp], [u].[Email], [u].[EmailConfirmed], [u].[FirstName], [u].[LastName], [u].[LockoutEnabled], [u].[LockoutEnd], [u].[NormalizedEmail], [u].[NormalizedUserName], [u].[PasswordHash], [u].[PhoneNumber], [u].[PhoneNumberConfirmed], [u].[SecurityStamp], [u].[TwoFactorEnabled], [u].[UserName]
FROM [AspNetUsers] AS [u]
WHERE [u].[NormalizedEmail] = @__normalizedEmail_0
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AspNetUsers'.
So the system is trying to run the query:
SELECT TOP(1) [u].[Id], [u].[AccessFailedCount], [u].[ConcurrencyStamp], [u].[Email], [u].[EmailConfirmed], [u].[FirstName], [u].[LastName], [u].[LockoutEnabled], [u].[LockoutEnd], [u].[NormalizedEmail], [u].[NormalizedUserName], [u].[PasswordHash], [u].[PhoneNumber], [u].[PhoneNumberConfirmed], [u].[SecurityStamp], [u].[TwoFactorEnabled], [u].[UserName]
FROM [AspNetUsers] AS [u]
WHERE [u].[NormalizedEmail] = @__normalizedEmail_0
And is getting the error:
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AspNetUsers'.
Did you apply migrations to database?
I really do not know how but it works. I dropped database and then updated
@KodowyWojtek - Are you saying that your app is working now when you do dotnet run?
yes...but it can be temporary solution
You need to make sure that when you run your app, your database is up-to-date. If you are using templates then DatabaseMiddleware should show error page when site is trying to use unavailable database along with a way to apply migrations. If you do not want to update database separately outside of dotnet run command then you can perhaps use DbContext.Migrate() method as a solution. Though it could have side-effects when you have more than one database where you have to apply migrations. Generally, deploying the application (and updating database) is kept separate from running the application. Choice is yours though.
Thanks
Most helpful comment
You need to make sure that when you run your app, your database is up-to-date. If you are using templates then DatabaseMiddleware should show error page when site is trying to use unavailable database along with a way to apply migrations. If you do not want to update database separately outside of
dotnet runcommand then you can perhaps useDbContext.Migrate()method as a solution. Though it could have side-effects when you have more than one database where you have to apply migrations. Generally, deploying the application (and updating database) is kept separate from running the application. Choice is yours though.