I'm using Entity Framework .Net CORE 2.2 for my database models and in my code I'm using
public void Configure(IApplicationBuilder app, IHostingEnvironment env, MyContextModel MyContext) {
[snipped for clarity]
MyContext.Database.Migrate();
}
to action any migrations into the database. It works fine locally, running any changes as necessary. If I publish my project to Azure, everything builds and uploads fine but when the web site starts I get the message
"An error occurred while starting the application."
in the browser window and the tables remain unchanged. I've removed and republished without MyContext.Database.Migrate();
and the site starts fine, so I'm sure it's something to do with the automatic migration that's causing the problem. I've Googled around and tried putting the line in the DbInitializer
and various other places, with no luck.
I've checked Cloud Explorer and I'm logged in so there are no permission issues.
Any ideas what I'm missing or how to whether (and how) I should be reading some Azure log?