0

I'd like my class library (part of our architecture) to have a default app setting for an api path it needs to call, and the client of this dll (our web api) to override this default value, if needed.

I put the key/value in App.config file section AppSettings with the default value (class library), and on the web api I set a new value for this key.

From Web Api, when I read the value (using ConfigurationManager.AppSettings["my_key"]), the value returned is from web.config of web api project. Ok so far. But if I delete this entry from web.config, the call to ConfigurationManager.AppSettings["my_key"]) returns null, that is, the value is not been read from App.config (which contains the default value).

How can I read AppSettings of my dll from web api classes?

Or is there any use for App.Config files on solutions which contain DLLs and web api / web mvc projects?

TIA

I'm using Visual Studio 2015 - .Net Framework 4.5.2 - MVC 5

Agnel Amodia
  • 765
  • 8
  • 18

0 Answers0