Webconfig access

0
0

Hello,

I started a project using WiseJ -latest version. I noticed it was using .net 48 . I am trying to target .net Core to run on linux, so i changed it to target just .net 9.

Now my webconfig is not longer being read using:

string ls_path = System.Configuration.ConfigurationManager.AppSettings[“Files.DataPath”];

The .net core docs say that the file it tries to read is app.config ?

What am i doing wrong ?

 

  • You must to post comments
0
0

So -question – if running under .Net Core – WiseJ does not need any of the settings from the Webconfig at all ?

  • You must to post comments
0
0

Ahh I see. I was going by the WiseJ docs. Figured you guys were reading from Web config behind the scenes no matter what.

  • You must to post comments
0
0

Net core doesn’t support web.config – web.config won’t be read if you target only net core.

You can either  use app.config or set up environment variables in launchSettings.json

If you’re just trying to do something like reading a connection string from the web.config file, you can just copy and paste the things you want in app.config.

Finally you can use  https://learn.microsoft.com/en-us/dotnet/api/system.configuration.configurationmanager.openmappedexeconfiguration and read web.config.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.