李昊 пре 4 година
родитељ
комит
a9620c5741
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7 5
      GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

+ 7 - 5
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -25,6 +25,7 @@ using Dapper;
 using GxPress.Result.App.User;
 using GxPress.Result.Job;
 using GxPress.Common.Http;
+using System.Net;
 
 namespace GxPress.Repository.Implement
 {
@@ -650,11 +651,12 @@ namespace GxPress.Repository.Implement
             {
                 var imServiceUrl = ConfigHelper.GetValue("ServiceAddress:ImUrl");
                 // var httpClientHandler = new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator };
-                var httpClientHandler = new HttpClientHandler
-                {
-                    ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true
-                };
-                HttpClient httpClient = new HttpClient(httpClientHandler); //http对象
+                // var httpClientHandler = new HttpClientHandler
+                // {
+                //     ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true
+                // };
+                ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
+                HttpClient httpClient = new HttpClient(); //http对象
                 HttpResponseMessage response = await httpClient.PostAsync(
                     $"{imServiceUrl}/users",
                     new JsonContent(new { username = request.Phone, password = "123456", nickname = request.Name }));