After publishing the complete ASP.NET MVC App, with FTP, with Visual Studio 2019, and everything working fine, database is cleared whenever I just upload one program change (DLL file publish)
I have published my first ASP.NET MVC Web App on a server. I published with FTP. All works fine but when I do a change on the code and try to upload/publish the one DLL file that changed, my database is cleared/reset.
Startup.cs will create the first user with generic password if not created yet. And this user is being created every time I upload the DLL file.
Is there anything I am missing on the web.config file? Or any other file?
If the Web App is in Production and I need to do a change, I was hoping not to have to save the database in order to do a minor update.
UPDATE ON ISSUE Thanks to @Logarr's comments below I realised that I had to look elsewhere for an answer - not a problem with the way I was publishing but a Entity Framework issue. Checked the code again and I realised that DBContext definition had the default database.initializer:
Database.SetInitializer(new MySqlInitializer());'
So I changed it to:
Database.SetInitializer<ApplicationDbContext>(new CreateDatabaseIfNotExists<ApplicationDbContext>());
A rookie mistake, I am sure but if anyone has any comment on this solution, please let me know.