While working on Entities in .Net, you may have face the following error:
EntityConnection error: The specified named connection is either not found in the configuration...
This is just a tricky error. It occurs when .Net cannot found the named connection string in your web.config or app.config file.
Example:
public NorthwindContext() : base("name=NorthwindEntities", "NorthwindEntities")
{
// your code here
}
In this example .Net can't found "NorthwindEntities" in the configuration file.
Solution:
- Make sure the connection string exists in your configuration file.
- If you are using multi tier architecture (multiple projects in the solution) then copy the connection string from the configuration file of the project containing edmx file to the configuration file of the Windows form or Web form project (web.config or app.config) which is set as startup project.