-
[C#] 기본 연결이 닫혔습니다. 보내기에서 예기치 않은 오류가 발생했습니다.프로그래밍/C# + Unity 2019. 11. 18. 17:40728x90
C#에서 HttpWebRequest를 이용하여 서버와 통신할 때, '기본 연결이 닫혔습니다. 보내기에서 예기치 않은 오류가 발생했습니다.'와 같은 오류가 나온다면, 해결방법은 다음과 같다.
1. 해당 프로젝트의 프레임워크 버전을 4.5.2이상으로 올린다.
2. 아래 코드를 적용한다.
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3; ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls; ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11; ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
728x90'프로그래밍 > C# + Unity' 카테고리의 다른 글
HttpWebRequest 루트 인증서와 해당 도메인 인증서 확인하기. (0) 2020.05.18 [OpenCVSharp] bgr과 inrange함수 (0) 2020.02.16 [Unity] Easy Save Plugin to PlayerPrefs (0) 2019.11.04 typeof switch (패턴일치) (0) 2019.11.04 매개변수 List<T>의 비밀 (0) 2019.08.27 댓글