microsoft-graph-api - MSAL + Graph AcquireTokenForClient 问题
问题描述
间歇性问题或一段时间后停止工作:从 .NET Core WEB API 调用 AcquireTokenForClient 时出现 SSL 错误。
在开发机器上运行良好。在服务器中看到此问题,但不确定何时停止。IIS 服务器在本地运行并使用 MSAL 调用 Azure AD。
直接从 Microsoft Sample 中用于连接到 Graph 的代码......
app = ConfidentialClientApplicationBuilder.Create(AuthHelper.ClientId)
.WithTenantId(AuthHelper.Tenant)
.WithClientSecret(AuthHelper.ClientSecret)
.Build();
// a tenant administrator
`string[] scopes = new string[] { "https://graph.microsoft.com/.default" };
AuthenticationResult result = null;
try
{
result = await app.AcquireTokenForClient(scopes)
.ExecuteAsync(System.Threading.CancellationToken.None);
}
异常:无法建立 SSL 连接,请参阅内部异常。\nTrace
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancelToken)
解决方案
推荐阅读
- javascript - 如何动态传递道具?
- c# - 从 LiteDB 执行 LINQ 时转换为 .ToList() 时的性能问题大约。100 万条记录
- sql - 加入前与加入后选择列
- angular - Angular中的渐进式上传文件
- python - 如何在开发过程中重命名 Flask WSGI App?
- laravel - 如何在 Laravel eloquent 中使用 via 对象获取数据?
- c++ - 尝试绘制存储在数组中的矩形,但只出现一个矩形?
- jenkins-pipeline - 在 Jenkins 中使用 kubectl 应用“deployment.yaml”时出错
- swift - 当我启动我的仅 xib 项目时,会出现两个窗口
- navigation - 此处 Maps SDK 插入字符串以播放音频