Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.config, app.config or both?

Tags:

asp.net-core

I have an ASP.NET Core project targeting .NET 4.5.2. I have some old components in the project that need web.config for configuration and I can't migrate them to the new appsettings.json. Right now I'm in development and running the application in console mode but it will be hosted in IIS in production. My question is, do I have to maintain both app.config and web.config simultaneously? When I build the application I only see MyProject.exe.config in the output folder which has app.config contents, but when I publish it I see both MyProject.exe.config and web.config in the output folder.

like image 490
dstr Avatar asked Aug 24 '26 02:08

dstr


1 Answers

While it's true that you will need a web.config when running Kestrel behind IIS, that web.config will only be used for configuring IIS. If you are running Asp.Net Core there is no easy way for you existing dlls to get access to the settings in the web.config. You can learn more here: Access Web.config settings in Asp.Net Core App?

like image 178
RonC Avatar answered Aug 25 '26 19:08

RonC