李昊 před 4 roky
rodič
revize
7ba2eb2d3d

+ 6 - 1
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -657,7 +657,12 @@ namespace GxPress.Repository.Implement
                 // };
                 // HttpClientHandler clientHandler = new HttpClientHandler();
                 // clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
-                HttpClient httpClient = new HttpClient(); //http对象
+
+                var httpClientHandler = new HttpClientHandler();
+                // Return `true` to allow certificates that are untrusted/invalid
+                httpClientHandler.ServerCertificateCustomValidationCallback =
+        HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
+                HttpClient httpClient = new HttpClient(httpClientHandler); //http对象
                 HttpResponseMessage response = await httpClient.PostAsync(
                     $"{imServiceUrl}/users",
                     new JsonContent(new { username = request.Phone, password = "123456", nickname = request.Name }));