You will probably get this error when you are trying to use one edmx object from another project, and normally happens with a WCF service or a WinForm Application.
This is the scenario; we have one project where we have the data model (AxxiaDALSP) . In order to make that work we will call that dll (project) from our test harness (TestHarness) project. We are working with .NET 3.5 because we are developing something for Sharepoint and when we call our object we get: “The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid.”.
- Be sure that the App.Config is empty:
<?xml version="1.0" encoding="utf-8"?>
- Go to the edmx file and double click.
- Remove everything from there.
- Right click in the blank area->Update Model From Database. Follow the steps.
- Right click in the blank area->Properties->Metadata Artifact Processing:Embed in Output Assembly.
- Copy the generate connection string and paste it into your winform App.Config or Web.Config. This is what you should copy:
<add name="axxia01Entities" connectionString="metadata=res://*/AxxiaDataModel.csdl|res://*/AxxiaDataModel.ssdl|res://*/AxxiaDataModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=xxxmyserverxxx;Initial Catalog=xxmytablexxx;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
- Everything should work now!
Conclusion: This bug can be fixed in many ways, but this is the only one that worked for me. It comes in Visual Studio 2010.