【发布时间】:2017-06-19 08:43:26
【问题描述】:
我在我的 asp.net 核心 API 中添加了一个 mastercard sdk。对 api 的调用在我的本地机器上运行良好。但是在 azure 上部署时会抛出上述错误。
我什么都试过了。
我已将调试器附加到实时站点。当我打电话时它会抛出错误 设置身份验证
public MatchType RequestCall(string consumerKey, string keyAlias, string keyPassword)
{
byte[] certificateBytes = GetCertificateStream();
ApiConfig.SetAuthentication(new OAuthAuthentication(consumerKey, certificateBytes, keyAlias, keyPassword));
ApiConfig.SetSandbox(true);
RequestMap map = GenerateRequestMap();
TerminationInquiryRequest response = TerminationInquiryRequest.Create(map);
return GetMatchType(response);
}
public byte[] GetCertificateStream()
{
var resourceName = typeof(TerminationMatchInquiry).GetTypeInfo().Assembly.GetManifestResourceNames()[0];//Get certificate resource name
using (Stream CertStream = typeof(TerminationMatchInquiry).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName))
{
byte[] RawBytes = new byte[CertStream.Length];
for (int Index = 0; Index < CertStream.Length; Index++)
{
RawBytes[Index] = (byte)CertStream.ReadByte();
}
return RawBytes.ToArray();
}
}
【问题讨论】:
-
您是否在 Google 上搜索过您的错误消息?它带来了一些有希望的结果。
-
哦,是的。但仍然没有运气
-
我很惊讶,甚至编译。我找不到在第二个参数中采用字节数组的
OAuthAuthentication的重载。您是否尝试过使用 .p12 文件的路径而不是从资源中读取它? -
是的。我现在有点接近了。我认为这是一个超时问题。
标签: c# azure asp.net-core-mvc