728x90
728x170

HttpClientHandler 사용 시 SSL 무시하는 코드입니다.

var httpClientHandler = new HttpClientHandler();
httpClientHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
httpClientHandler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true;

var httpClient = new HttpClient(httpClientHandler);

httpClient.BaseAddress = new Uri("https://localhost:7018/WeatherForecast/");

// API 호출
var result = await httpClient.GetAsync("GetWeatherForecastData");

HttpClientHandler 의 ServerCertificateCustomValidationCallback 을 true 로 반환하게 하면 처리됩니다.

728x90
그리드형
Posted by kjun
,