No Connection String Named 'Myentities' Could Be Found in the Application Config File

No connection string named 'MyEntities' could be found in the application config file

Try copying the connections string to the .config file in the MVC project.

No connection string named could be found in the application config file

You say "within my DAL, I have a webConfig". I guess the connection string is in the configuration file of a referenced class library, but not in the main configuration file you have in your entry project (a web api project, I guess looking at the tags).

If so, just copy the connection string in the entry project configuration file.

No connection string named xxx' could be found in the application config file

I've been having the exact same problem, and the answer is IT'S BUGGY! In my case, my DbContext subclass is expecting a connection string in app.config, so that is what you must provide under <configuration>

  <connectionStrings>
<add name="NameOfMyContext" connectionString="RemovedForSecurity" providerName="System.Data.SqlClient" />
</connectionStrings>

Now, build and run the project. Go into the /bin/Debug/ folders until you find the yourappname.exe and the yourappname.exe.config files. Examine the yourappname.exe.config file. This is a weird blend of your various xml config files from your project. Make sure your connection string is in there.

I've had a very buggy experience with that file. Doing a "clean" doesnt remove it, so you can wind up in a situation where you remove all references to the connection string in your project (i.e. remove it from app.config), and your app still works because the string remains in that odd .exe.config file.

No connection string named 'MyApplicationEntities' could be found in the application config file

Ah, figured this out accidentally.

I had to remove

public MasterEntities()
: base("name=MyApplicationEntities")
// ^^^^^
{
}

to

public MasterEntities()
: base("MyApplicationEntities")
{
}

EF 4.3 does not like connection string being called name=xxxxx

C# addin with EF6 - No connection string named 'Entities' could be found in the application config file

Unfortunately the way Solidworks is loading your addin dll prevents you (or libraries that you are using like EF) from accessing .config file in the usual way. The easiest solution for you is to use overloaded constructor for your entities object and pass connection string from code.



Related Topics



Leave a reply



Submit