fix(tenpayv2): 修复 .NET 4.6.X 目标框架下运行错误的问题

This commit is contained in:
Fu Diwei 2024-07-25 00:56:40 +08:00
parent b451588bff
commit 02aa982641
2 changed files with 3 additions and 4 deletions

View File

@ -41,7 +41,6 @@
<ItemGroup>
<PackageReference Include="SKIT.FlurlHttpClient.Common" Version="3.1.0" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="8.0.1" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup>
</Project>

View File

@ -15,13 +15,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Settings
handler.SslOptions = new SslClientAuthenticationOptions() { RemoteCertificateValidationCallback = static (_, _, _, _) => true };
#elif NET471_OR_GREATER
HttpClientHandler handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = static (_, _, _, sslPolicyErrors) => sslPolicyErrors == SslPolicyErrors.None;
handler.ServerCertificateCustomValidationCallback = static (_, _, _, _) => true;
#elif NET462_OR_GREATER
WebRequestHandler handler = new WebRequestHandler();
handler.ServerCertificateValidationCallback = static (_, _, _, _) => true;
#else
WinHttpHandler handler = new WinHttpHandler();
handler.ServerCertificateValidationCallback = static (_, _, _, _) => true;
HttpClientHandler handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = static (_, _, _, _) => true;
#endif
if (certificateBytes is not null)