using Kurisu.AspNetCore.Startup; using Microsoft.IdentityModel.Logging; class Program { static void Main(string[] args) { KurisuHost.Run(args); } } public class Startup : DefaultStartup { public Startup(IConfiguration configuration) : base(configuration) { IdentityModelEventSource.ShowPII = true; } /// public override void ConfigureServices(IServiceCollection services) { base.ConfigureServices(services); services.AddHttpClient("jinko.oa", (_, _) => { }) .ConfigurePrimaryHttpMessageHandler(() => { var handler = new HttpClientHandler { ClientCertificateOptions = ClientCertificateOption.Manual, ServerCertificateCustomValidationCallback = (_, _, _, _) => true }; return handler; }); services.AddHttpClient("jinko.httpclient", (sp, httpClient) => { // "BaseUrl": "https://oapi.dingtalk.com", // "AgentId": "2768073678", // "AppId": "dingumelppews6rah7x9", // "AppSecret": "nsWfJTVjYesHVzrLiP-t1TQqMQvC1L_kZNfXfnIyzcXK4pCTfKprkjZcxAbsDR_l", httpClient.BaseAddress = new Uri("https://oapi.dingtalk.com"); httpClient.Timeout = TimeSpan.FromSeconds(30); }) // .SetHandlerLifetime(TimeSpan.FromMinutes(5)) // .addd((res) => // { // return HttpPolicyExtensions // .HandleTransientHttpError() // .OrResult(msg => msg.StatusCode != HttpStatusCode.OK) // .WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))); // }) .ConfigurePrimaryHttpMessageHandler(() => { var handler = new HttpClientHandler { ClientCertificateOptions = ClientCertificateOption.Manual, ServerCertificateCustomValidationCallback = (_, _, _, _) => true }; return handler; }); } }