【问题标题】:Not able to get prices from stripe using stripe prices api无法使用条带价格 api 从条带获取价格
【发布时间】:2021-06-04 11:44:54
【问题描述】:

我正在尝试使用条带 api 调用从 asp.net mvc 项目中的条带获取价格。这些代码在本地工作并从条带获取所有价格,但是当我在生产服务器中运行代码时,它显示并出错。 我正在使用此代码

StripeConfiguration.ApiKey = "my-key";
            var options = new PriceListOptions { Limit = 10,Active=true };
            options.AddExpand("data.product");
            var service = new PriceService();
            StripeList<Price> prices = service.List(options);

            return View(prices);

它在线显示的错误是

连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应 34.241.54.72:80

【问题讨论】:

    标签: asp.net-mvc api stripe-payments http-status-code-500


    【解决方案1】:

    您应该运行reachability tool 以确保您的服务器能够与 Stripe 的服务器通信。如果没有,您需要弄清楚网络配置的哪一部分阻止了连接,并为 Stripe 发布的domains and IP addresses 添加适当的规则。

    如果这只是间歇性的,您可以尝试启用automatic retries 以查看问题是否会好转。

    StripeConfiguration.MaxNetworkRetries = 3;
    

    【讨论】:

      【解决方案2】:

      问题出在托管服务提供商 (IONOS) 上,在 web.config 文件中添加代理后已解决。

      <system.net>
        <defaultProxy>
           <proxy  proxyaddress="http://winproxy.server.lan:3128" bypassonlocal="true"/>  
        </defaultProxy>
      </system.net>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-07-01
        • 2020-07-31
        • 1970-01-01
        • 2021-01-25
        • 2021-12-05
        • 2018-06-12
        • 2021-06-25
        相关资源
        最近更新 更多