0
    
    
        
                    duyan11110 created
                    
                    
                    
                
                - ABP Framework version: 7.0.3
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace: Could not retrieve the OpenId Connect discovery document! ErrorType: Exception. Error: Error connecting to http://authserver:7000/.well-known/openid-configuration. HTTPS required. Volo.Abp.AbpException: Could not retrieve the OpenId Connect discovery document! ErrorType: Exception. Error: Error connecting to http:/authserver:7000/.well-known/openid-configuration. HTTPS required. at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.GetDiscoveryResponse(IdentityClientConfiguration configuration) at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.CreateClientCredentialsTokenRequestAsync(IdentityClientConfiguration configuration) at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.GetTokenResponse(IdentityClientConfiguration configuration) at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.GetAccessTokenAsync(IdentityClientConfiguration configuration) at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.GetAccessTokenOrNullAsync(String identityClientName) at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.TryAuthenticateAsync(HttpClient client, String identityClientName) at Volo.Abp.Http.Client.IdentityModel.IdentityModelRemoteServiceHttpClientAuthenticator.Authenticate(RemoteServiceHttpClientAuthenticateContext context) at Volo.Abp.Http.Client.IdentityModel.Web.HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.Authenticate(RemoteServiceHttpClientAuthenticateContext context) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at MyService.TransactionReports.TransactionReportClientProxy.GenerateReportFileAsync() in ...\MyService.HttpApi.Client\ClientProxies\TransactionReportClientProxy.Generated.cs:line 150 at BackgroundWorker.MyService.ScanErrorFileWorker.SendReportFile() in ...\apps\background-workers\src\BackgroundWorker\MyService\ScanErrorFileWorker.cs:line 86 at BackgroundWorker.MyService.ScanErrorFileWorker.Execute(IJobExecutionContext context) in ...\apps\background-workers\src\BackgroundWorker\MyService\ScanErrorFileWorker.cs
Steps to reproduce the issue: I'm using Quartz background worker to call an authorized app service method with above error. Here's appsettings.json:
"RemoteServices": {
    "MyService": {
      "BaseUrl": "http://myservice.httpapi.host:7005/",
      "UseCurrentAccessToken": "false"
    }
  },
  "IdentityClients": {
    "Default": {
      "GrantType": "client_credentials",
      "ClientId": "BackgroundWorker.DockerHttp",
      "ClientSecret": "1q2w3e*",
      "Authority": "http://authserver:7000",
      "Scope": "MyService"
    }
  }
[DependsOn(
    typeof(AbpAutofacModule),
    typeof(AbpBackgroundWorkersQuartzModule),
	typeof(AbpHttpClientIdentityModelWebModule),
	typeof(AbpIdentityHttpApiClientModule),
	...
)]
public class BackgroundWorkerModule : AbpModule
{
    public override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
    {
        var logger = context.ServiceProvider.GetRequiredService<ILogger<BackgroundWorkerModule>>();
        var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>();
        logger.LogInformation($"MySettingName => {configuration["MySettingName"]}");
        var hostEnvironment = context.ServiceProvider.GetRequiredService<IHostEnvironment>();
        logger.LogInformation($"EnvironmentName => {hostEnvironment.EnvironmentName}");
        return Task.CompletedTask;
    }
}
OpenIdDictDataSeeder.cs
//Background Worker
await CreateApplicationAsync(
	name: "BackgroundWorker.DockerHttp",
	type: OpenIddictConstants.ClientTypes.Confidential,
	consentType: OpenIddictConstants.ConsentTypes.Implicit,
	displayName: "Background Worker",
	secret: "1q2w3e*",
	grantTypes: new List<string>
	{
		OpenIddictConstants.GrantTypes.ClientCredentials
	},
	
	scopes: commonScopes.Union(new[] { "MyService" }).ToList(),
	permissions: new List<string> { MyServicePermissions.TransactionReports.Default, MyServicePermissions.TransactionReports.GenerateFile }
);
How can I fix it? Thank you.
4 Answer(s)
- 
    0Error: Error connecting to http:/authserver:7000/.well-known/openid-configuration. HTTPS required. You need to use HTTPS. 
- 
    0I use HTTP not HTTPS. In AdministrationService, it has the same setting and work fine (no need HTTPS). "AuthServer": { "Authority": "http://authserver:7000", "RequireHttpsMetadata": "false", "SwaggerClientId": "WebGateway_Swagger.DockerHttp" }, "RemoteServices": { "AbpIdentity": { "BaseUrl": "http://identityservice.httpapi.host:7002/", "UseCurrentAccessToken": "false" } }, "IdentityClients": { "Default": { "GrantType": "client_credentials", "ClientId": "AdministrationService.DockerHttp", "ClientSecret": "1q2w3e*", "Authority": "http://authserver:7000", "Scope": "IdentityService" } },
- 
    0Hi, I'm not sure about your project details. you can set the RequireHttpsto false if you want to use HTTP."IdentityClients": { "Default": { "GrantType": "client_credentials", "ClientId": "BackgroundWorker.DockerHttp", "ClientSecret": "1q2w3e*", "Authority": "http://authserver:7000", "Scope": "MyService", "RequireHttps": false }
- 
    0Hi, Thank you so much for your prompt support. It works now. 
 
                                