多环境简单使用,简单记录

//------------多环境  获取数组下面的值 
  "DBS": [
    {
      "ConnId": "MYSQL1",
      "Connection": "server=112.11.33.55\\ms2012;uid=sa;pwd=123;database=databaseqq;"
    } ,
    {
      "ConnId": "MYSQL2",
      "Connection": "server=.;Database=ddd;Uid=root;Pwd=1234526;Port=10060;Allow User Variables=True;"
    }
  ]

 _configuration.GetSection("DBS:0:Connection").Value ----- 获取数组下面的值


launchSettings.json
{
  "profiles": {  //节点下  MyLocal  ,new5
    "CloudCubic": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:8081"
    },
    "MyLocal": {
      "ylfid": "mylocal",
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "MyLocal"
      },
      "applicationUrl": "http://localhost:8082"
    },
    "new5": {
      "ylfid": "new5",
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "new5"
      },
      "applicationUrl": "http://localhost:8083"
    },

dotnet qq.Api.dll --urls="http://*:8081"
dotnet qq.Api.dll --urls="http://*:8082"
dotnet qq.Api.dll --urls="http://*:8083"

 

posted @ 2023-06-02 19:13  天天向上518  阅读(5)  评论(0编辑  收藏  举报