I've been trying to connect my ASP.NET MVC application to a SQL database without success.
I have in my DAL project, in App.config:
<connectionString>
<add name="CrmContext" connectionString="..." providerName="..." />
</connectionString>
And in my WebUI project, in the Web.config file I have:
<connectionString>
<add name="CrmContext" connectionString="..." providerName="..." />
</connectionString>
My context in the DAL project is declared like this:
public CrmContext() {
Database.SetInitializer(new CrmDbInitializer());
}
The initial seeding of the database works fine, but then when a Controller tries to access the database it gives me the error:
SQL Network interfaces, Error: 26 - Error locating Server
Apparently it tries to create/access the database in App_data folder. I've tried many things for hours and nothing works...
I'm using EntityFramework and Code-First approach.