I have a typical requirement. We have several WCF services using NetHttpBinding. We are developing a new Core Web API for a new project.
We plan to use the existing WCF DLLs in new web API that. one of the DLLs is data layer that uses connection string form Web.config file.
The new Core Web API uses these existing DLLs. However, We cannot change the existing WCF services nor can we change the DLLs to use appsettings.json file because WCF Services are still used by legacy application.
First I thought I would just define the connection strings in web API appsettings.json. It did not work.
Next, I added a web config file to the new Core Web API and defined the connection strings there, it did not work.
I cannot call WCF service from Web API because it uses custom binding such as NetHTTPBinding that I may have define in Web API.
I could use WCF Dlls from any other application such as console application using the web config. I thought I could use same concept with Web API by referncing the DLLs directly, but the DLLs is reading neither the appsettings.json nor the web config file.
Any insight will be appreciated.
Here is the scenario
Current WCF Service S1 uses DLL D1. D1 uses web config to read the web config. this works as part of WCF services. No problem here.
Created a new Core Web API that uses its own appsettings.json. for its own connection string.
the new Core Web API uses the existing DLL D1. However, D1 does not read connection string from AppSeetings.json.
Then I added a Web Config file to the Core Web API. Still the DLL D1 does not read the connection string from Web.Config.