我正在尝试将 api url 保存在 appsettings 中。但是,configuration.Propertiers 似乎是空的。我不确定如何获得设置。在 program.cs 中:
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
//string url = builder.Configuration.Properties["APIURL"].ToString();
foreach (var prop in builder.Configuration.Properties)
Console.WriteLine($"{prop.Key} : {prop.Value}" );
//builder.Services.AddSingleton<Service>(new Service(url));
builder.RootComponents.Add<App>("app");
await builder.Build().RunAsync();
}
Run Code Online (Sandbox Code Playgroud)