使用用户机密
鼠标右键项目,管理用户机密。VS 就会自动帮我们创建一个 secrets.json 文件用户存储配置。
secrets.json 文件默认创建在 C:\Users\moon\AppData\Roaming\Microsoft\UserSecrets\xxx(guid)\ 目录下。
launchSettings.json
推荐将设置存储在 launchSettings.json 中。因为该方式存在项目本地,修改起来比较灵活。
"profiles": {"IIS Express": {"commandName": "IISExpress","launchBrowser": true,"environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development","MyKey": "appsetting.launchSettings.json"}},
