Archive for December, 2009

Listed below are some issues and solution you may come across when trying access a LINQ to Entity layer from a WCF Service located in a separate project.

Problem:
Argument Exception: “The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid.”

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

Solution:

The class library which contains the EDMX file contains an app.config file with the entity connection string. When access this from the WCF layer, there is no reference to it unless you include it in the web.config of the WCF layer

To fix the problem, copy the connection string from the app.config to the ConnectionStrings section of the web.config of the WCF project.

However, on doing this, you may receive another exception message:

MetadataException: Unable to load the specified metadata resource.
MetadataException : Unable to load the specified metadata resource

connectionString=”metadata=res://*/Model.Project.csdl|res://*/Model.Project.ssdl|res://*/Model.Project.msl;

to

connectionString=”metadata=res://*/;