riseres riseres - 1 year ago 135
C# Question

CodeFirst cannot create database on shared hosting

I want to deploy Entity Framework 5.0 to Shared Hosting.

Now I have the problem with database. I cannot create database.

<add name="ResContext"
connectionString="Data Source=XXXX5.db.10232343.hostedresource.com;
Initial Catalog=XXXX5; User ID=XXXX5;
Password=XXXXXXXXX!;Integrated Security=false"


I got the problem

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

But when I change provideName to


Keyword not supported: 'data source'.

Answer Source

Typically GoDaddy does not give you permission to create or drop databases programmatically. They only allow you to create those databases through their user interface. This is because they don't want people creating databases all over the place, and they want to ensure that only you have the rights to access the database in a shared user environment.

So you cannot use the default generation method that EF uses. Instead, you would use the Database initializer:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download