I have hosted identityserver which is using self signed certificate in IIS in one my azure VM. This is ssl enabled site. This is using identityserver3 framework.
I am hosting asp.net core 2.0 webapi in the same VM and this is not ssl enabled. Below is my setup on core 2.0 api side:
Startup.cs -> ConfigurationServices() {
services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "https://localhost:44300/identity";
options.RequireHttpsMetadata = false;
options.ApiName = "web_api";
options.LegacyAudienceValidation = true;
});
}
Both were working fine locally with the above setup. But in the vm when i try to access the api, i am getting following error:
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
I made sure the self-signed certificate is available in
MMC->trused certifcates both in Current User and in Local Computer.
Self signed certificate is available in :
MMC-> Local Computer -> Personal Certificates Local COmputer -> Trusted Root Certificates
MMC ->Current User -> Trusted Root Certificates