C#C
C#2y ago
Peponis

Unhandled exception. System.IO.FileNotFoundException

Hi, so I am trying to publish my app to Azure and when i try to load the page it gives Application Error. When searching application logs in azure i found this :

Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings..json' was not found and is not optional. The expected physical path was '/home/site/wwwroot/appsettings..json'.

My program.cs (the part where I configure the appsettings) :

var builder = WebApplication.CreateBuilder(args);

var configuration = new ConfigurationBuilder()
    .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", false)
    .AddJsonFile($"appsettings.{Environment.UserName}.json", true)
    .Build();


And I uploaded the stracture of my appsettings.

Am very new as a developer, so if you need me to provide somethimg more tell me .

Thanks in advance.
errorWebApp.PNG
appsettings.PNG
Was this page helpful?