Invoke-WebRequest를 사용해서 Https 연결 시도
영어로 찾아보니 해당 문장이었다.
The underlying connection was closed - Could not\nestablish trust relationship for the SSL/TLS secure channel.
하지만 바로 위와 같은 에러가 출력되면서 WebRequest가 정상적으로 진행되지 않았다.
그래서 파워 구글링을 시도하였다. 그리고 몇몇 시도와 테스트 끝에 해결 방법을 찾았다.
이는 인증서 혹은 윈도우 버전이 TLS/SSL 버전과 맞지 않아서 발생하는 이슈이다.
아래의 명령어를 입력하면 이를 우회할 수 있다.
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
이제 정상적으로 https 요청이 보내진다.
참고 사이트
Could not establish trust relationship for the SSL/TLS secure channel with Invoke-Webrequest from PowerShell
When I try to use Invoke-WebRequest on https, I'm getting some weird error: Invoke-WebRequest : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure
stackoverflow.com
How to resolve - The underlying connection was closed - Could not\nestablish trust relationship for the SSL/TLS secure channel i
How to resolve The underlying connection was closed Could notnestablish trust relationship for the SSL TLS secure channel in PowerShell - When you run Invoke-WebRequest or Invoke-RestMethod command, sometimes you get the error “The underlying connection
www.tutorialspoint.com
'프로그래밍' 카테고리의 다른 글
도메인 주도 개발(Domain-Driven Development) 모델과 모델링 (1) | 2024.11.20 |
---|---|
/**/* 은 무슨 뜻일까? Glob 패턴에 대해서 알아보자 (1) | 2024.10.23 |
PowerShell의 Invoke-WebRequest로 Post Request 보내기 (1) | 2024.09.27 |
DTO란? DTO에 대해서 알아보자 (1) | 2024.09.11 |
유니티(Unity) TextMeshPro input에서 입력받은 text가 뭔가 이상함 (1) | 2024.09.11 |
댓글