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

Viewed 94237

I have a one entity framework object and when I add it to my project, the connectionstring is added to app.config in the connectionstring section, but when I want to create new entitycontext and use this connectionstring, this error appears

12 Answers

Well... this problem could be also for a very simple (dumb) reason... I copied a file from another project and forgot to change the ConnectionString on the EntityDataSource... as I was at the beginning of the project and happened in the login page, I thought it was something on the config, but was just the wrong connection string name (and DefaultContainerName).

So I had a similar issue with JetBrains Rider. What I was doing was using the green ▶ button next to the main function. This was causing the above message to show. If I instead right clicked on the project itself and clicked run, then it worked.

Not sure why this worked by I'm assuming it's because Rider does not read the app.config if running the individual function?

Related