Cannot drop the database 'DB', because it does not exist or you do not have permission

c# database entity-framework-6 visual-studio-2013


I'm collaborating on a school assignment with three other students. Microsoft Visual Studio 2013 is what we're utilizing, and Visual Studio Online serves as our version control system. .Net MVC 5 EF6 is used for the project. We are encountering issues as a group that we cannot resolve.

The issue we are having is as follows. When one of us attempts to run the project with or without debugging after grabbing the most recent version control changes, the following error is displayed in the browser:

Because it does not exist or you do not have authorization, you cannot drop the database "DB."

If we create a migration and update the database, we can make it work. However, this is making us relocate far too frequently and giving us a lot of issues.

We are unable to determine whether a setting is incorrect or if there is another issue. I'm hoping someone can assist us sort things out so we can resume doing our jobs more effectively.

Additionally, goDaddy hosts the site and database.

4/7/2015 3:16:21 AM

Accepted Answer

I'll wager that you haveAutomaticMigrationsEnabled set totrue because you pulled the most recent version from TFS; otherwise, your application wouldn't be attempting to interact with your database.

Additionally, unless in rare circumstances, automatic migrations won't attempt to drop your database.DropCreateDatabaseWhenModelChanges or DropCreateDatabaseAlways setup of database initializers. Verify your code. You have most likely. The following article. Do not put these into production, please.

Additionally, your malicious database initializer is unable to do its function since the ASP.NET user on GoDaddy likely lacks authorization to do so.

My suggestion: disableAutomaticMigrationsEnabled Do you manually migrate your data usingadd-migration and update-database . AutomaticMigrationsEnabled is not a recommended method. Even EF7 is doing away with it. That ought to take care of your issue.

4/7/2015 3:16:00 AM

Popular Answer

Utilizing VSS/TFS for version control or using GoDaddy as an ISP—which is worse?

ANYWAY, here are two ideas:

1) Make use of local workspaces (and only check in/out updates when you want to synchronize):

2) Before syncing versions, check to see if VSO allows a macro or script to "destroy all" connections:

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow