ASP.NET Core 1.0 ConfigurationBuilder().AddJsonFile(“appsettings.json”); not finding file
Or
"The configuration file 'appsettings.json' was not found and is not optional. The physical path is
"The configuration file 'appsettings.json' was not found and is not optional. The physical path is
Resolution
I was working on .net core for the first time and confronted an issue during development.it was throwing an error in Startup class .it count not find appsettings.json file from current directory.
Here is the solution for that as depicted belo
put these lines in such a way may help to mitigate an issue:
var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
Configuration = builder.Build();
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
Configuration = builder.Build();
Thanks
Warm Regards
Sachin Kalia
0 comments :
Post a Comment