【发布时间】:2018-08-30 03:39:13
【问题描述】:
我的 salesforce res api 一直运行良好。当我突然开始收到身份验证错误时。 重试您的请求。 Salesforce.Common.AuthenticationClient.d__1.MoveNext().
salesforce 告知它将从现在开始使用 TLS .1.2。如何强制我的 asp.net core 2.0 在 Startup.cs 中使用 TLS 1.2。以下是我的登录代码。
private async Task<AuthenticationClient> GetValidateAuthentication()
{
RestApiSetting data = new RestApiSetting(Configuration);
var auth = new AuthenticationClient();
var url = data.IsSandBoxUser.Equals("true", StringComparison.CurrentCultureIgnoreCase)
? "https://test.salesforce.com/services/oauth2/token"
: "https://login.salesforce.com/services/oauth2/token";
try
{
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
await auth.UsernamePasswordAsync(data.ConsumerKey,
data.ConsumerSecret, data.Username, data.Password, url);
return auth;
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
【问题讨论】:
-
这并没有告诉我如何以及在何处实现 UseHttps。
-
对于.net,我曾经运行一个注册表项,.net core 应该有类似的方法,请查看下面的页面以获取.net one help.salesforce.com/articleView?id=000221207&type=1
-
我找不到任何
-
AuthenticationClient 是 Salesforce 库中的某个类吗?
标签: c# salesforce asp.net-core-2.0