【发布时间】:2018-07-27 08:04:51
【问题描述】:
我在我的一个 Azure VM 中托管了在 IIS 中使用自签名证书的身份服务器。这是启用 ssl 的站点。这是使用 identityserver3 框架。
我在同一个 VM 中托管 asp.net core 2.0 webapi,但未启用 ssl。 以下是我在 core 2.0 api 方面的设置:
Startup.cs -> ConfigurationServices() {
services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "https://localhost:44300/identity";
options.RequireHttpsMetadata = false;
options.ApiName = "web_api";
options.LegacyAudienceValidation = true;
});
}
通过上述设置,两者在本地都可以正常工作。但是在 vm 中,当我尝试访问 api 时,出现以下错误:
ERROR Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler - Exception occurred while processing message. - System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'https://localhost:44300/identity/.well-known/openid-configuration'. ---> System.IO.IOException: IDX10804: Unable to retrieve document from: 'https://localhost:44300/identity/.well-known/openid-configuration'. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: A security error occurred
我确保自签名证书在
中可用MMC->当前用户和本地计算机中的受信任证书。
自签名证书可用于:
MMC-> 本地计算机 -> 个人证书 本地计算机 -> 受信任的根证书
MMC ->当前用户 -> 受信任的根证书
【问题讨论】:
标签: asp.net-core-2.0 identityserver4 azure-virtual-machine