When publishing my first ASP.NET Core 2.1 web app in Azure from Visual Studio 2017, I am setting up EF migrations like in the picture below:
After running Publish
, the identity table is not created. In Configure -> Settings I have info, that No databases found in the project
.
Also I am using console command:
dotnet ef database update --context AppIdentityDbContext
What gives me same result. Connection strings I am taking from Azure Show database connection strings
, updateting them with username and password.
I am not sure what I am doing wrong here. Everything works perfectly on my computer. I will be thankful for any suggestions to check.
Right now, after trying to populate Identity table: public static class IdentitySeedData
{
private const string adminUser = "****";
private const string adminPassword = "****";
public static async Task EnsurePopulated(UserManager<IdentityUser> userManager)
{
IdentityUser user = await userManager.FindByIdAsync(adminUser);
if (user == null)
{
user = new IdentityUser("Admin");
await userManager.CreateAsync(user, adminPassword);
}
}
}
I am getting error:
AggregateException: One or more errors occurred. (Invalid object name 'AspNetUsers'.)
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)
SqlException: Invalid object name 'AspNetUsers'.
System.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__108_0(Task<SqlDataReader> result)
UPDATE: I found out, that my problem occurs only identity database.