The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
Posted on August 23rd, 2010 at 7:03 am
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.
Interested in this topic? You might enjoy another article we've written called
- Message: Failed to download a platform extension: System.ComponentModel.DataAnnotations.zip
- How To Create and Consume REST Web Service using WCF
- extendedProtectionPolicy tag problem: Workaround
- ScrollViewer Scroll Change Event in Silverlight
- How to Store Sessions in SQL Server