在 AWS elasticbeanstalk 中使用 P12 文件调用 RestSharp

问题描述

我的 ASP 有问题。网络核心应用。 我必须使用证书 P12 在我的应用程序中调用外部 API。

        string certFile = envConfig.P12Path;
        X509Certificate2 certificate = new X509Certificate2(certFile,envConfig.P12Pass);
        client.ClientCertificates = new X509CertificateCollection() { certificate };
        client.Proxy = new WebProxy();


        client.Timeout = -1;
        var demandRequest = new RestRequest(Method.POST);
        demandRequest.AddHeader("Content-Type","application/xml");
        demandRequest.AddParameter("application/xml",xml,ParameterType.RequestBody);
        IRestResponse response = client.Execute(demandRequest);

在 localhost 中,它可以工作,但是,当我在 elasticbeanstalk AWS(在 64 位 Windows Server 2019/2.5.10 上运行的 IIS 10.0)中发布我的应用程序时,我遇到了问题:“无法识别提供给包的凭据”。

有人有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)