I have connection string in azure api configuration with the same name, but when i go to api, swagger, it tells me - System.PlatformNotSupportedException: LocalDB is not supported on this platform.
returning 500 status.
this is how i get connection string from api:
private string _connectionString = string.Empty;
public string GetConnectionString(string name)
{
var configurationBuilder = new ConfigurationBuilder();
var path = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json");
configurationBuilder.AddJsonFile(path, false);
var root = configurationBuilder.Build();
_connectionString = root.GetSection("ConnectionStrings").GetSection(name).Value;
var appSetting = root.GetSection("ApplicationSettings");
return _connectionString;
}
API project is on .net 5