What is the best approach for user defined configuration data under ASP.net CORE?

91 views Asked by At

We are just getting started to convert our ASP.Net based application to .Net CORE. One decision we need to make now is what configuration file format we should use. In our current ASP.Net based app, we use web.config file's AppSettings for our application configuration data. But with ASP.Net core, things look much different now. The AppSettings, for instance, is no longer supported by web.config. Although the "environmentVariable" property of the new web.config seems support user config data, that doesn't seem to be the only ways for doing that. According to this article, Json configurations file, XML file, and even ini file can all be used for application/user configuration purpose. Can someone tell me if it is a bad idea if I keep using web.config file for our application configuration under .net CORE? What's the downsides of doing so? and why should I chose one over the others?

1

There are 1 answers

0
Majid Shahabfar On BEST ANSWER

In .NET Core preferred format is json and main config file is appsettings.json There is not web.config file when you creating a new ASP.NET project but you can see web.config file when you publish your app which mostly contains config setting for beyond your application, something about IIS, production machine and etc. So, simply use appsettings.json file to configure your application setting in lightweight json format.