Pages

Monday, August 23, 2010

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

I was working on entity framework to access the underlying data using data access layer. I've added EDMX file, generated the required entity classes and was ready to go.

When i ran the application, i have encountered with "The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid." error. I was really confused, as I have not modified the connection string manually. Entity framework generated edmx file and updated the webconfig file with the connection string.

After spending a good amount of time on this issue, i found out the solution for this issue and is explained below:

Problem: The created entity model .edmx file is in a class library project which i have created for accessing the data and the connection string is generated in the web.config file in the same class library project. When the application is running, the application checks for the connection string in the web.config file residing in the website project and it is not able to find there. This is the cause for the issue.

Solution: Moving the connection string from newly created class library project to the website project.
Hope this helps someone. :)

No comments:

Post a Comment