Question: How do you resolve IConfiguration config get value from appSettings.json that returns a null value?
Login to See the Rest of the Answer
Answer: There is a chance you created the appSettings.json file and it is not present in the bin folder. Remember, when the Asp.Net Core Application runs in debug mode, the compiler reads the files from the bin Directory. Follow the steps below to see the bin directory.
Step 1: In Visual Studio Solution Explorer menu bar, click on icon with three document icons.
Step 2. You will notice a bin folder show up
Step 3. Right-click on the AppSettings.json file in your project and navigate to "Properties"
Step 4. In the Advanced section, switch from "Do not copy" to "Copy Always" this will include the AppSettings.json file in the bin Directory or Release Directory every time you build your project.
Step 5. Build your project and try to retrieve the configuration values from the AppSettings.json again. The values should now be retrieved.
Leave a comment below if this helped you out, so that other Developers can find it useful.