Browse Source

用配置绝对接口地址

develop
胡超1 2 years ago
parent
commit
5153ba33d6
  1. 2
      WebApplication1/Controllers/TwentySystemController.cs

2
WebApplication1/Controllers/TwentySystemController.cs

@ -32,7 +32,7 @@ namespace WebApplication1.Controllers
ip = configuration.GetSection("Configs:SystemIp").Value; ip = configuration.GetSection("Configs:SystemIp").Value;
port = configuration.GetSection("Configs:Port").Value; port = configuration.GetSection("Configs:Port").Value;
httpClient = httpClientFactory.CreateClient(); httpClient = httpClientFactory.CreateClient();
httpClient.BaseAddress = new Uri("http://143.120.5.116:8080"); // new Uri($"http://{ip}:{port}"); httpClient.BaseAddress = new Uri($"http://{ip}:{port}");
httpClient.DefaultRequestHeaders.Add("Accept", "application/json"); httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
httpClient.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample"); httpClient.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample");
httpClient.DefaultRequestHeaders.ConnectionClose = true; httpClient.DefaultRequestHeaders.ConnectionClose = true;

Loading…
Cancel
Save