I am working a school project with three other group members. We are using Microsoft Visual Studio 2013, and using Visual Studio Online as version control. The project is worked with .Net MVC 5 EF6. Our group is having troubles that we cannot figure out.
Here is the problem we are having. Every time that one of use grabs the newest version control changes and attempts to run the project with or without debug we get an error in browser:
"Cannot drop the database 'DB', because it does not exist or you do not have permission."
We can get it to work if we add a migration and update database. But this is causing us to have to migrate way to often and causing a lot of headaches.
We cannot figure out if we have a setting messed up or something else. I am hoping that someone can help us resolve this issue so we can get back to working more efficiently.
Also site and DB are hosted on goDaddy.
My bet is that you have
AutomaticMigrationsEnabled set to
true, otherwise your application wouldn't be trying to do anything with your database just because you pulled the latest version from TFS.
Also, automatic migrations don't try to drop your database, not unless your have
DropCreateDatabaseAlways database initializers set up. Check your code. You probably have. Here's an article. Please do not have these on production.
Also, your villain database initializer isn't being able to do it's job because the ASP.NET user on GoDaddy probably doesn't have permission to do so.
My advice: Disable
AutomaticMigrationsEnabled. Do you migrations manually with
AutomaticMigrationsEnabled is not a good practice. It's even being discontinued from EF7. That should solve your problem.
I'm not sure which is worse: using GoDaddy as an ISP, or using VSS/TFS for version control :(
ANYWAY - Two suggestions:
1) Use local workspaces (and just checkin/checkout updates when you wish to synchronize):
2) See if VSO supports a macro or script to "kill all" connections before you sync versions: