Dotnet 3.1 Stripe:无法建立SSL连接,请参阅内部异常

问题描述 投票:0回答:1

我实现了条带支付网关,它可以在我的本地系统上运行,但不能在生产服务器上运行,这是一个基于Linux服务器的

CentOs7

给出了我的代码: [HttpPost]

public async Task<IActionResult> PaymentUsingStripe(string stripeToken, string stripeEmail, double price, int companyid)
{
  try
  {
    var config = await _dbContext.SuperAdminConfiguration.Select(x => new { x.StripeSecret }).FirstOrDefaultAsync();
    if (config != null)
      StripeConfiguration.ApiKey = config.StripeSecret;

    var company = await _dbContext.Companies.Include(c => c.CompanyConfiguration).Where(x => x.IsDeleted == false && x.CompanyId == companyid).FirstOrDefaultAsync();
    if (company == null)
    {
      return NotFound();
    }
    var myCharge = new Stripe.ChargeCreateOptions();

    myCharge.Amount = (long)price;
    myCharge.Currency = "USD";
    myCharge.ReceiptEmail = stripeEmail;
    myCharge.Description = company.Name;
    myCharge.Source = stripeToken;
    myCharge.Capture = true;
    var chargeService = new Stripe.ChargeService();
    Charge stripeCharge = chargeService.Create(myCharge);
    if (stripeCharge.Status != "failed")
    {
     // further my application logic

堆栈跟踪:

 Web.Areas.SuperAdminPortal.Controllers.IdentificationController[0]
         at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
         at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
      --- End of stack trace from previous location where exception was thrown ---
         at System.Net.Security.SslStream.ThrowIfExceptional()
         at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
         at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
         at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
         at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
         at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
      --- End of stack trace from previous location where exception was thrown ---
         at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)

我尝试了

dotnet
证书命令,创建了
dotnet certifactes
,在
SSL
上重新更新了
nginx
,但不起作用...也在 HTTP 和 HTTPs 上运行它,但抛出异常。

.net-core openssl stripe-payments centos7
1个回答
0
投票

NET Core 3.1 的生命周期已结束一年多了:https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-1#long-term -支持

由于太旧了,它无法可靠地支持 TLSv1.2,而这是对 Stripe 进行 API 调用的要求。他们的建议是更新到 NET Core 4.5

我建议更新到受支持/现代/安全的平台,特别是对于要处理客户数据的代码。

https://stripe.com/blog/completing-tls-upgrade

https://archive.is/If4Jq

© www.soinside.com 2019 - 2024. All rights reserved.