My solution have three projects:
- dll Library that has the edmx EF Core used as DAL for Oracle database
- library for business logic that references the mentioned above dll
- ASP.NET Core webservice application that reference the business logic dll
All three target the same version of .NET framework: 4.6.1
To get the webservice to work and access the database I had to copy the App.config file from EntityFramework project to the Webservice project.
Everything was working fine until I decided migrating from ASP.NET 5 RC1 to ASP.NET Core 1.0.
After migration the web.config appeared in the webservice project root directory (other than the one that has been there under wwwroot folder) and I ran into the error mentioned here apparently because now I have two configuration files (app.config and web.config), the solution of removing the app.config made sense.
So I copied the all the sections from the app.config to the web.config and removed the app.config, which solved my first problem but now whenever I try to use the DBContext
, I'm stuck with this exception:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: No connection string named 'DBEntities' could be found in the application config file.
I noticed that the after publishing the application, the file myApp.exe.config does not have the connection strings any more. My question is simple, how do I get the application to look for the connection string in the web.config?!
I found some similer questions like this one, that and that but none of them has answers to my question.