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

no connection string named could be found in the application config file web config
no connection string named could be found in the application config file unit test
no connection string named could be found in the application config file azure function
migrate. exe no connection string named
no connection string found
system invalidoperationexception could not find a connection string named default
web.config connection string
entity framework connection string

I'm using EF and generated .EDMX from it but then I only wanted it to be used for automated generation of Class Files.

I then used the Class Files to create a Entity Model and then created a DB Context and then Repository. I'm calling a WebApi (which is in a separate project but same solution) to access the repository to GET data. While I run the WebApi, I'm getting the error,

{"No connection string named 'DBEntities' could be found in the application config file."}

But within my DAL, I have a webConfig and that has the following entry so I'm not quite sure what has gone wrong,

add name="DBEntities" connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MY-PC;initial catalog=DB;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" 

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 could be found in the application config , config file will solve the issue. The easiest solution: Remove current edmx file and related connection string in app. config and add Edmx item with same name as previous again. I know this is asked several times before - and with mostly the same answer. But in these cases the problem often occours when more projects are using same entity and connectionstring not being present in all config files. In my case all is in the same project. And the connection string is present in App.config. I am using a viewmodel in XAML:

In the DBContext file, remove

public RaficaDB()
: base("name=DefaultConnection"){}

to

public RaficaDB()
: base("DefaultConnection"){}

EF 4.3, EF 5 and EF 6 do not like the connection string being called name=xxxxx

Answer found here -> No connection string named 'MyApplicationEntities' could be found in the application config file

Error: No connection string named .could be found in the , "No connection string named DBConnection could be found in the application config file." The DBContext.cs has following constructor public� System.InvalidOperationException: 'No connection string named 'Entities' could be found in the application config file.' Sign up for free to join this conversation on GitHub . Already have an account?

Insert following section in the configuration section of the .config file of the same project where your .edmx file is under.

You may also create different connection string for different environment in the .config file of the main project and pass any of the connection string as parameter of the constructor of the DBContext.

<connectionStrings>
  
<add name="DBEntities" connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MY-PC;initial catalog=DB;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />

</connectionStrings>

[SOLVED], Try copying the connections string to the .config file in the MVC project. {"No connection string named 'DBEntities' could be found in the application config file."} But within my DAL, I have a webConfig and that has the following entry so I'm not quite sure what has gone wrong,

Setting the project as Startup project worked for me

no connection string could be found in the application config file, "No connection string named 'PrismSpecMap' could be found in the application config file." As I said a year ago, that makes no sense at all. There� This error occurs when you haven’t set the correct value in your config or when you have one project calling another project. How? Why? Let’s see the details!

I found that this worked:

1) Check if you have several "App.config" files. 2) Check if has a wrong name than the connection string it has to use. 3) Save the project and run the program

It should work now.

No connection string named '…' could be found in the application , No connection string named 'MyEntities' could be found in the application config file. This error occurs when you haven't set the correct value in� Result Message: Test method DetailsRoleController threw exception: System.InvalidOperationException: No connection string named 'EquipmentEntities' could be found in the application config file. Here my test script:

No connection string named 'SMSEntities' could be found ., config, in console applications the app.config file. When you get the following runtime exception. Exception thrown: 'System. The problem is when I create an setup file, install it and run it (I use InstallShield). I get an exception: System.InvalidOperationException: No connection string named <the name of my connection string which is in App.config> could be found in the application config file. Here is my connection string

No connection string named 'MyApplicationEntities' could be found , shows the error "No connection string named 'SMSEntities' could be found in the application config file." there is a app.config file in my DAL. InnerException ----- No connection string named 'DbContext' could be found in the application config file. Where DbContext is the name of my code first context class.

EF cant find the connectionstring in app.config, It is throwing any exception now No connection string named ' MyApplicationEntities' could be found in the application config file. Now my config has it all

Comments
  • I'm sorry, it had tags so it didn't appear because of formatting. I have removed tags and its there
  • Please check my update, if it solves your problem please accept as answer :)
  • I did add the connection string to webapi and I now get the following, {"Schema specified is not valid. Errors: \r\nThe mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type Client}
  • Does this help? stackoverflow.com/questions/14927391/…
  • If you supply name=xxx to the constructor, it will look for that specific connection string and throw an error if not set. If you don't specify name=xxx, the localdb/sqlexpress will attempt to create it. msdn.microsoft.com/en-us/library/jj592674(v=vs.113).aspx
  • Please rename the web config to app.config in DAL project then.
  • Likewise; I was doing a code migeration from the Package Manager Console and it couldn't find my connection string in the app.config BECAUSE it was reading the app.config of a different project.