简体   繁体   中英

Blazor WASM wwwroot/appsettings.json not present in template

According to this article Blazor WASM loads configuration by default from wwwroot/appsettings.json and wwwroot/appsettings.{environment}.json. However, when I generate Blazor WASM apps there are no such files under wwwroot. My dotnet version is 5.0.101, I am on Ubuntu 20.04, and my target framework is net5.0. I do see files with such names in the Server project when I create a template hosted by ASP.NET core. Is that what it's actually referring to, or am I missing something else?

Ok, I see what happened. I misread the docs; there are appsettings.json files under wwwroot if you had the -au Individual flag to a blazor wasm app that is not hosted by asp.net core.

Yep. In case you need a template, here is a basic template:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",

  "ConnectionStrings": {
    "MyDatabase": "Server=???;Initial Catalog=???;User ID=???;Password=???",
  },

  "ApiSettings": {
    "SomeApiValue": "Some API value"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM