解决方案
config.SetBasePath(GetBasePath());
config.AddJsonFile("appsettings.json", false);
private string GetBasePath()
{
using var processModule = Process.GetCurrentProcess().MainModule;
return Path.GetDirectoryName(processModule?.FileName);
}