0
votes

I have Blazor .net core hosted webassembly app . So basically 3 projects included

  1. ---.Client

  2. ---.Server

    appsettings.json
    
    Startup.cs
    
  3. ---.Shared

I tried to access the appsettings using Configuration.GetSection, Configuration.Get, etc but the app is actually looking at the wrong file path. It looks for the appsettings.json file inside the .Client project. enter image description here I copied the appsettings.json in .Client project and it took the file. But I dont want to keep the appettings.json in .Client project. What is the solution for this?

Note: Publishing and running works just fine. Issue occurs when debugging only.

1

1 Answers

0
votes

I'm posting my findings here as an answer to my own question This seems like a bug, the appsettings.json in the Server project is not actually using. If you copy it to the Client project, then it should work when you debug it. However, the appsettings.json will work just fine if you run the app after publishing because the path looking for will be correct at that time. Copying to the Client project is no harm because it is not transferred to the browser when I tested it (debugging)