Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Basic config files

$
0
0

I'm not looking for anything complex here but, every time I read another page about this, it starts wading into stuff that is way too much for what I need. My web service creating in ASP.NET Core 2.1 needs to have a config file. In simpler times, I would have a config.xml or something. It will contain info such as:

<?xml version="1.0" encoding="utf-8" ?><configuration><appSettings><add key="UserId" value="user1" /><add key="UserPassword" value="Password123" /><add key="InterfaceVersion" value="1.0" /><add key="InterfaceName" value="WebApi" /><add key="TargetServer" value="localhost" /><add key="UserHTTPS" value="N" /><add key="LogFilePath" value="./ApiLogs/" /></appSettings></configuration>

When the web api is called, it needs to read the values from this config file. Don't worry about the password being in plain text. I have 2 controllers in my api that pick up HTTPPost data. During that call, the config needs to be read to pick up the info in it. That cannot be complicated can it? Can someone point me in the right direction or give me an example?


Viewing all articles
Browse latest Browse all 555

Trending Articles