21 lines
752 B
C#
21 lines
752 B
C#
using System.Net.Http.Headers;
|
|
using System.Text;
|
|
using Kurisu.AspNetCore.Startup;
|
|
|
|
namespace Dlhis.Basic;
|
|
|
|
public class JinkoSapHttpClientPack : BaseAppPack
|
|
{
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddHttpClient("jinko:sap", (_, httpClient) =>
|
|
{
|
|
httpClient.BaseAddress = new Uri($"http://sappipap01.jinkosolar.cn:50100");
|
|
httpClient.Timeout = TimeSpan.FromMinutes(10);
|
|
|
|
const string credentials = "EHS_USER:y3R1hd2h*RICAC";
|
|
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
|
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
|
});
|
|
}
|
|
} |