6

Ok, this question has been asked many times. Just googling with the error message:

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

I have tried all suggestions on forums, help sites et blogs... nothing works!

Situation recap

I'm splitting solution into three different projects: one for my model with EF4, one of WinForm and one ASP.NET MVC web application. I have a problem with connections string and configuration.

Is there a updated solution using VS2010/EF4/.NET Framework 4.0?

1
  • See this question. Commented Apr 27, 2010 at 20:33

2 Answers 2

5

Not sure, but you may have to move the Entity Framework configuration sections in your EF4 project's app.config file to both your WinForm app.config and ASP.NET MVC web.config files.

Sign up to request clarification or add additional context in comments.

Comments

3

Really, the answer is copying the <connectionStrings> section in the other project's config files like mentionned above.

<connectionStrings>
    <add name="DataEntities" connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=xxx;Initial Catalog=xxx;User Id=xxx;Password=xxx;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

So, it's the same answer as I saw before on many sites. In fact, it was working from the beginning, but I had another error ("Configuration system failed to initialize"), so I thought it was a wrong value of the connection string in the app.config. In fact, the app.config was valid, but just moving the section on bottom solved this... Bizarre?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.