Reference

EntityClient Provider Named Connection Not Found Or Not Valid

When using Entity Framework models in an environment with multiple projects, such as an N-Tier web applications, the following run-time exception may appear:

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid.

Tags: asp dotnet entityframework

Solution

After creating an entity model from a database or creating a database from an entity model, the Entity Framework automatically generates a database connection string that is stored in the App.config file of the project that contains the model. This configuration file is not accessible to other projects that wish to use the entity model.

The solution is to simply copy the connectionStrings section in the App.config file to the other project’s configuration file, i.e. Web.config for ASP.NET pages.