ядро .net с запущенным AWS в одном экземпляре - как прослушивать трафик https, а не только http - PullRequest
0 голосов
/ 19 февраля 2019

Я пытаюсь настроить свою программу IdentityServer для аутентификации пользователей на aws.

Я выполняю развертывание на одном экземпляре aws pc вместо использования elb.

Мой код клиентаследующим образом:

HttpClient client = new HttpClient();
DiscoveryResponse discoveryResponse = await client.GetDiscoveryDocumentAsync("http://pavestate-identity.ap-southeast-2.elasticbeanstalk.com");
if (discoveryResponse.IsError)
{
    throw new Exception();
}

Когда я пытаюсь получить доступ к серверу через порт 80, я получаю следующее сообщение об ошибке:

Exception = {"HTTPS required"}

Однако, когда я пытаюсь использовать https, время соединения истекает:

Error = "Error connecting to https://pavestate-identity.ap-southeast-2.elasticbeanstalk.com/.well-known/openid-configuration: An error occurred while sending the request."

Я могу получить доступ к https на моем сервере при локальном запуске aftr, обновляя launchSttings.json, чтобы иметь applicationUrl, включающий https, как вы можете видеть ниже

"IdentityServer": {
  "commandName": "Project",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  },
  "applicationUrl": "http://localhost:5000/;https://localhost:5000/"
}

Это хорошо, как, но не помогает при развертывании на AWS.Я пробовал несколько разных настроек с помощью launchSettings.json, но я все еще получаю только http трафик.На данный момент мой конфиг:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost/;https://localhost/",
      "sslPort": 443
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchUrl": "http://localhost/;https://localhost/",
      "applicationUrl": "http://localhost/;https://localhost/",
      "sslPort": 443,
      "launchBrowser": true,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "launchUrl": "http://localhost/;https://localhost/",
      "environmentVariables": {
        "applicationUrl": "http://localhost/;https://localhost/",
        "sslPort": "443",
        "Hosting:Environment": "Staging"
      },
      "sdkVersion": "dnx-clr-win-x86.1.0.0-rc1-update1"
    },
    "kestrel": {
      "commandName": "kestrel",
      "launchUrl": "http://localhost/;https://localhost/",
      "environmentVariables": {
        "applicationUrl": "http://localhost/;https://localhost/",
        "sslPort": "443",
        "Hosting:Environment": "Production"
      },
      "sdkVersion": "dnx-clr-win-x86.1.0.0-rc1-update1"
    }
  }
}

Итак, мой вопрос: что мне здесь делать?Является ли launchSettings.json правильным способом установки этого параметра на сервере?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...