The following blog explains this well. If you did not specify a connection string in your web.config than EF, CodeFirst will try to create a database on your local SQLExpress instance. Otherwise, you can set the intent by assigning a named string connnection through the public constructor of the context of your objects, inheriting from the base constructor.
http://blogs.msdn.com/b/adonet/archive/2011/01/27/using-dbcontext-in-ef-feature-ctp5-part-2-connections-and-models.aspx
public class UnicornsContext : DbContext { public UnicornsContext() : base("UnicornsCEDatabase") { } }
In any case, you will need to make sure that your account has appropriate access to the SQL (Express) server to create a new database.
source share