abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.97k stars 3.45k forks source link

Bearer error="invalid_token" #21265

Open weiwxg opened 3 weeks ago

weiwxg commented 3 weeks ago

I created a layered project based on ABP Framework 8.2 and deployed it to the local environment using Docker Desktop. When I call the API in Swagger, an error occurs.

The Dockerfile files for several projects are as follows:

# src/Jee.Im.System.DbMigrator/Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
ENTRYPOINT ["dotnet", "Jee.Im.System.DbMigrator.dll"]

# src/Jee.Im.System.AuthServer/Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
RUN dotnet dev-certs https -v -ep openiddict.pfx -p aeef0d8c-7288-4d0c-9454-72338dd8111c

FROM base AS final
WORKDIR /app
COPY --from=build /src .

ENTRYPOINT ["dotnet", "Jee.Im.System.AuthServer.dll"]

# src/Jee.Im.System.HttpApi.Host/Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
ENTRYPOINT ["dotnet", "Jee.Im.System.HttpApi.Host.dll"]

The docker-compose.yml file:

name: im-main

networks:
  abp-network:

services:
  redis: 
    image: redis:7.4.1
    container_name: redis
    ports:
      - "6379:6379"
    restart: always
    networks:
      - abp-network

  mysql:
    image: mysql:8.4.3
    container_name: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=123456
    ports:
      - "3306:3306"
    volumes:
      - /mysql/conf.d:/etc/mysql/conf.d
      - /mysql/datadir:/var/lib/mysql
    restart: always
    networks:
      - abp-network

  system-db-migrator:
    image: reg.biw.com/im/main/system-db-migrator:latest
    container_name: system-db-migrator
    build:
      context: .
      dockerfile: src/Jee.Im.System.DbMigrator/Dockerfile
    environment:
      - OpenIddict__Applications__System_Web=System_Web
      - OpenIddict__Applications__System_ClientSecret=1q2w3e*
      - OpenIddict__Applications__System_RootUrl=https://localhost:5601
      - OpenIddict__Applications__System_Swagger__ClientId=System_Swagger
      - OpenIddict__Applications__System_Swagger__RootUrl=https://localhost:5201
    depends_on:
      - mysql
    networks:
      - abp-network

  authserver:
    image: reg.biw.com/im/main/authserver:latest
    container_name: authserver
    build:
      context: .
      dockerfile: src/Jee.Im.System.AuthServer/Dockerfile
    environment:
      - ASPNETCORE_URLS=https://+:443;http://+:80;      
      - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
      - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc
      - App__SelfUrl=https://localhost:5200
      - App__CorsOrigins=https://localhost:5201,https://localhost:5202,https://localhost:5203,https://localhost:5204,https://localhost:5601,http://localhost:5602,http://localhost:5603,http://localhost:5604
      - App__RedirectAllowedUrls=https://localhost:5201,https://localhost:5202,https://localhost:5203,https://localhost:5204,https://localhost:5601,http://localhost:5602,http://localhost:5603,http://localhost:5604
      - ConnectionStrings__Default=Server=mysql;Port=3306;Database=im_system;Uid=root;Pwd=123456
      - Redis__Configuration=redis
    ports:
      - "5200:443"
    depends_on:
      - mysql
      - redis
    restart: on-failure
    volumes:
      - ./certs:/root/certificate
    networks:
      - abp-network

  system-api:
    image: reg.biw.com/im/main/system-api:latest
    container_name: system-api
    hostname: system-api
    build:
      context: .
      dockerfile: src/Jee.Im.System.HttpApi/Host/Dockerfile
    environment:
      - ASPNETCORE_URLS=https://+:443;http://+:80;      
      - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
      - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc
      - App__SelfUrl=https://localhost:5201
      - App__CorsOrigins=https://localhost:5601
      - AuthServer__Authority=https://localhost:5200
      - AuthServer__RequireHttpsMetadata=true
      - AuthServer__SwaggerClientId=System_Swagger
      - ConnectionStrings__Default=Server=mysql;Port=3306;Database=im_system;Uid=root;Pwd=123456
      - Redis__Configuration=redis
    ports:
      - "5201:443"
    depends_on:
      - mysql
      - redis
    restart: on-failure
    volumes:
      - ./certs:/root/certificate
    networks:
      - abp-network

Run docker-compose to start the project, and access https://localhost:5201/swagger/index.html.

1730797830450

maliming commented 2 weeks ago

Please check this document https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-docker-compose

builder.SetIssuer(new Uri(configuration["AuthServer:Authority"]));

weiwxg commented 2 weeks ago

It still doesn't work after adding builder.SetIssuer(new Uri(configuration["AuthServer:Authority"]));

if (!hostingEnvironment.IsDevelopment())
{
    PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
    {
        options.AddDevelopmentEncryptionAndSigningCertificate = false;
    });

    PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
    {
        serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "aeef0d8c-7288-4d0c-9454-72338dd8111c");
        serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]));
    });
}

docker-compose.yml

  authserver:
    image: reg.biw.com/im/main/authserver:latest
    container_name: authserver
    build:
      context: .
      dockerfile: src/Jee.Im.System.AuthServer/Dockerfile
    environment:
      - ASPNETCORE_URLS=https://+:443;http://+:80;      
      - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
      - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc
      - App__SelfUrl=https://localhost:5200
      - App__CorsOrigins=https://localhost:5201,https://localhost:5202,https://localhost:5203,https://localhost:5204,https://localhost:5601,http://localhost:5602,http://localhost:5603,http://localhost:5604
      - App__RedirectAllowedUrls=https://localhost:5201,https://localhost:5202,https://localhost:5203,https://localhost:5204,https://localhost:5601,http://localhost:5602,http://localhost:5603,http://localhost:5604
      - AuthServer__Authority=https://localhost:5200/
      - ConnectionStrings__Default=Server=mysql;Port=3306;Database=im_system;Uid=root;Pwd=123456
      - Redis__Configuration=redis
    ports:
      - "5200:443"
    depends_on:
      - mysql
      - redis
    restart: on-failure
    volumes:
      - ./certs:/root/certificate

  system-api:
    image: reg.biw.com/im/main/system-api:latest
    container_name: system-api
    hostname: system-api
    build:
      context: .
      dockerfile: src/Jee.Im.System.HttpApi/Host/Dockerfile
    environment:
      - ASPNETCORE_URLS=https://+:443;http://+:80;      
      - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
      - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc
      - App__SelfUrl=https://localhost:5201
      - App__CorsOrigins=https://localhost:5601
      - AuthServer__Authority=https://localhost:5200/
      - AuthServer__RequireHttpsMetadata=true
      - AuthServer__SwaggerClientId=System_Swagger
      - ConnectionStrings__Default=Server=mysql;Port=3306;Database=im_system;Uid=root;Pwd=123456
      - Redis__Configuration=redis
    ports:
      - "5201:443"
    depends_on:
      - mysql
      - redis
    restart: on-failure
    volumes:
      - ./certs:/root/certificate
maliming commented 2 weeks ago

Please check and share your app error logs.

weiwxg commented 2 weeks ago

The log of server system-api as below:

2024-11-06 14:03:14 [06:03:14 INF] Request starting HTTP/2 GET https://localhost:5201/abp/Swashbuckle/SetCsrfCookie - null null
2024-11-06 14:03:14 [06:03:14 INF] Failed to validate the token.
2024-11-06 14:03:14 Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException: IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.
2024-11-06 14:03:14    at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuerAsync(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14    at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14    at Microsoft.IdentityModel.Tokens.InternalValidators.ValidateAfterSignatureFailed(SecurityToken securityToken, Nullable`1 notBefore, Nullable`1 expires, IEnumerable`1 audiences, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignature(JsonWebToken jwtToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignatureAndIssuerSecurityKey(JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateJWSAsync(JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:14 [06:03:14 INF] Bearer was not authenticated. Failure message: IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.
2024-11-06 14:03:15 [06:03:14 INF] Executing endpoint 'Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle)'
2024-11-06 14:03:15 [06:03:15 INF] Route matched with {area = "Abp", action = "SetCsrfCookie", controller = "AbpSwashbuckle", page = ""}. Executing controller action with signature Void SetCsrfCookie() on controller Volo.Abp.Swashbuckle.AbpSwashbuckleController (Volo.Abp.Swashbuckle).
2024-11-06 14:03:15 [06:03:15 INF] Executed action Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle) in 16.8575ms
2024-11-06 14:03:15 [06:03:15 INF] Executed endpoint 'Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle)'
2024-11-06 14:03:15 [06:03:15 INF] Request finished HTTP/2 GET https://localhost:5201/abp/Swashbuckle/SetCsrfCookie - 204 null null 107.9089ms
2024-11-06 14:03:15 [06:03:15 INF] Request starting HTTP/2 GET https://localhost:5201/api/identity/roles/all - null null
2024-11-06 14:03:15 [06:03:15 INF] Failed to validate the token.
2024-11-06 14:03:15 Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException: IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.
2024-11-06 14:03:15    at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuerAsync(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15    at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15    at Microsoft.IdentityModel.Tokens.InternalValidators.ValidateAfterSignatureFailed(SecurityToken securityToken, Nullable`1 notBefore, Nullable`1 expires, IEnumerable`1 audiences, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignature(JsonWebToken jwtToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignatureAndIssuerSecurityKey(JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15    at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateJWSAsync(JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
2024-11-06 14:03:15 [06:03:15 INF] Bearer was not authenticated. Failure message: IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.
2024-11-06 14:03:15 [06:03:15 INF] Executing endpoint 'Volo.Abp.Identity.IdentityRoleController.GetAllListAsync (Volo.Abp.Identity.HttpApi)'
2024-11-06 14:03:15 [06:03:15 INF] Route matched with {area = "identity", controller = "Role", action = "GetAllList", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.ListResultDto`1[Volo.Abp.Identity.IdentityRoleDto]] GetAllListAsync() on controller Volo.Abp.Identity.IdentityRoleController (Volo.Abp.Identity.HttpApi).
2024-11-06 14:03:15 [06:03:15 INF] Authorization failed. These requirements were not met:
2024-11-06 14:03:15 PermissionRequirement: AbpIdentity.Roles
2024-11-06 14:03:15 [06:03:15 WRN] ---------- RemoteServiceErrorInfo ----------
2024-11-06 14:03:15 {
2024-11-06 14:03:15   "code": "Volo.Authorization:010001",
2024-11-06 14:03:15   "message": "授权失败!提供的策略尚未授予。",
2024-11-06 14:03:15   "details": null,
2024-11-06 14:03:15   "data": {},
2024-11-06 14:03:15   "validationErrors": null
2024-11-06 14:03:15 }
2024-11-06 14:03:15 
2024-11-06 14:03:15 [06:03:15 WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
2024-11-06 14:03:15 Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
2024-11-06 14:03:15    at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy)
2024-11-06 14:03:15    at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
2024-11-06 14:03:15    at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
2024-11-06 14:03:15    at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
2024-11-06 14:03:15    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
2024-11-06 14:03:15    at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
2024-11-06 14:03:15    at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
2024-11-06 14:03:15    at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
2024-11-06 14:03:15    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
2024-11-06 14:03:15    at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
2024-11-06 14:03:15    at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
2024-11-06 14:03:15    at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
2024-11-06 14:03:15    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
2024-11-06 14:03:15    at lambda_method2028(Closure, Object)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
2024-11-06 14:03:15 --- End of stack trace from previous location ---
2024-11-06 14:03:15    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2024-11-06 14:03:15 [06:03:15 WRN] Code:Volo.Authorization:010001
2024-11-06 14:03:15 [06:03:15 INF] AuthenticationScheme: Bearer was challenged.
2024-11-06 14:03:15 [06:03:15 INF] Executed action Volo.Abp.Identity.IdentityRoleController.GetAllListAsync (Volo.Abp.Identity.HttpApi) in 184.9514ms
2024-11-06 14:03:15 [06:03:15 INF] Executed endpoint 'Volo.Abp.Identity.IdentityRoleController.GetAllListAsync (Volo.Abp.Identity.HttpApi)'
2024-11-06 14:03:15 [06:03:15 INF] Request finished HTTP/2 GET https://localhost:5201/api/identity/roles/all - 401 0 null 432.3762ms
maliming commented 2 weeks ago

IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.

See https://abp.io/support/questions/8139/Authentication-Cookie-is-not-being-saved-on-Angular-application#answer-3a15d675-1aad-a178-7bb5-c22ffd45ead5 https://github.com/abpframework/abp/issues/20034#issuecomment-2165727328

weiwxg commented 2 weeks ago

Thanks @maliming, I figured it out by adding this code to the services, adding the auth server on the list of valid issuers:

options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
{
    ValidIssuers = [configuration["AuthServer:Authority"]!.EnsureEndsWith('/')],
    SignatureValidator = (token, parameters) => new JsonWebToken(token)
};

But I still wandering why this problem didn't occur when deploying these servers in IIS?

weiwxg commented 2 weeks ago

Another error occured in Web service:

2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/ - null null 2024-11-06 16:15:41 [08:15:41 INF] Authorization failed. These requirements were not met: 2024-11-06 16:15:41 DenyAnonymousAuthorizationRequirement: Requires an authenticated user. 2024-11-06 16:15:41 [08:15:41 ERR] An unhandled exception has occurred while executing the request. 2024-11-06 16:15:41 System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://localhost:5200/.well-known/openid-configuration'. Will retry at '2024/11/6 08:15:43 +00:00'. Exception: 'System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'. 2024-11-06 16:15:41 ---> System.Net.Http.HttpRequestException: Connection refused (localhost:5200) 2024-11-06 16:15:41 ---> System.Net.Sockets.SocketException (111): Connection refused 2024-11-06 16:15:41 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 2024-11-06 16:15:41 at System.Net.Sockets.Socket.gWaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 --- End of inner exception stack trace --- 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) 2024-11-06 16:15:41 at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.SendAsyncAndRetryOnNetworkError(HttpClient httpClient, Uri uri) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) 2024-11-06 16:15:41 --- End of inner exception stack trace --- 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel)'. 2024-11-06 16:15:41 ---> System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'. 2024-11-06 16:15:41 ---> System.Net.Http.HttpRequestException: Connection refused (localhost:5200) 2024-11-06 16:15:41 ---> System.Net.Sockets.SocketException (111): Connection refused 2024-11-06 16:15:41 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 2024-11-06 16:15:41 at System.Net.Sockets.Socket.gWaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 --- End of inner exception stack trace --- 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) 2024-11-06 16:15:41 at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-11-06 16:15:41 at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.SendAsyncAndRetryOnNetworkError(HttpClient httpClient, Uri uri) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) 2024-11-06 16:15:41 --- End of inner exception stack trace --- 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) 2024-11-06 16:15:41 --- End of inner exception stack trace --- 2024-11-06 16:15:41 at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleChallengeAsyncInternal(AuthenticationProperties properties) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleChallengeAsync(AuthenticationProperties properties) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.ChallengeAsync(AuthenticationProperties properties) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.<>cDisplayClass0_0.<gHandle|0>d.MoveNext() 2024-11-06 16:15:41 --- End of stack trace from previous location --- 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) 2024-11-06 16:15:41 at Volo.Abp.AspNetCore.Security.Claims.AbpDynamicClaimsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>cDisplayClass2_0.<b0>d.MoveNext() 2024-11-06 16:15:41 --- End of stack trace from previous location --- 2024-11-06 16:15:41 at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>cDisplayClass2_0.<b0>d.MoveNext() 2024-11-06 16:15:41 --- End of stack trace from previous location --- 2024-11-06 16:15:41 at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) 2024-11-06 16:15:41 at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 2024-11-06 16:15:41 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>cDisplayClass2_0.<b0>d.MoveNext() 2024-11-06 16:15:41 --- End of stack trace from previous location --- 2024-11-06 16:15:41 at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.gAwaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) 2024-11-06 16:15:41 [08:15:41 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2024-11-06 16:15:41 [08:15:41 INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2024-11-06 16:15:41 [08:15:41 INF] Executing ViewResult, running view ~/Views/Error/Default.cshtml. 2024-11-06 16:15:41 [08:15:41 INF] Authorization failed. These requirements were not met: 2024-11-06 16:15:41 PermissionRequirement: SettingManagement.Accounts 2024-11-06 16:15:41 [08:15:41 INF] Authorization failed. These requirements were not met: 2024-11-06 16:15:41 PermissionRequirement: SettingManagement.IdentityManagement 2024-11-06 16:15:41 [08:15:41 INF] Authorization failed. These requirements were not met: 2024-11-06 16:15:41 PermissionRequirement: SettingManagement.Accounts 2024-11-06 16:15:41 [08:15:41 INF] Authorization failed. These requirements were not met: 2024-11-06 16:15:41 PermissionRequirement: SettingManagement.IdentityManagement 2024-11-06 16:15:41 [08:15:41 INF] Executed ViewResult - view ~/Views/Error/Default.cshtml executed in 8.9414ms. 2024-11-06 16:15:41 [08:15:41 INF] Executed action Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) in 11.6022ms 2024-11-06 16:15:41 [08:15:41 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/ - 500 null text/html; charset=utf-8 18.2175ms 2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/__bundles/LeptonXLite.Global.C8BD9C08002E46065415D954057C9304.js?_v=638664777226181839 - null null 2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/bundles/LeptonXLite.Global.990E1D9D56F35BC96DF720644CF93F6F.css?_v=638664777218758918 - null null 2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/Abp/ApplicationLocalizationScript?cultureName=zh-Hans - null null 2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/Abp/ApplicationConfigurationScript - null null 2024-11-06 16:15:41 [08:15:41 INF] Request starting HTTP/2 GET https://localhost:5601/Abp/ServiceProxyScript - null null 2024-11-06 16:15:41 [08:15:41 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController.GetAsync (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Route matched with {area = "Abp", action = "Get", controller = "AbpApplicationLocalizationScript", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.ActionResult] GetAsync(Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto) on controller Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController (Volo.Abp.AspNetCore.Mvc). 2024-11-06 16:15:41 [08:15:41 INF] Route matched with {area = "Abp", action = "Get", controller = "AbpApplicationConfigurationScript", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.ActionResult] Get() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController (Volo.Abp.AspNetCore.Mvc). 2024-11-06 16:15:41 [08:15:41 INF] Route matched with {area = "Abp", action = "GetAll", controller = "AbpServiceProxyScript", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult GetAll(Volo.Abp.AspNetCore.Mvc.ProxyScripting.ServiceProxyGenerationModel) on controller Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController (Volo.Abp.AspNetCore.Mvc). 2024-11-06 16:15:41 [08:15:41 INF] The file /bundles/LeptonXLite.Global.990E1D9D56F35BC96DF720644CF93F6F.css was not modified 2024-11-06 16:15:41 [08:15:41 INF] The file /bundles/LeptonXLite.Global.C8BD9C08002E46065415D954057C9304.js was not modified 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/__bundles/LeptonXLite.Global.C8BD9C08002E46065415D954057C9304.js?_v=638664777226181839 - 304 null application/javascript 2.4233ms 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/__bundles/LeptonXLite.Global.990E1D9D56F35BC96DF720644CF93F6F.css?_v=638664777218758918 - 304 null text/css 2.4552ms 2024-11-06 16:15:41 [08:15:41 INF] Executing ContentResult with HTTP Response ContentType of application/javascript 2024-11-06 16:15:41 [08:15:41 INF] Executed action Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc) in 4.9677ms 2024-11-06 16:15:41 [08:15:41 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/Abp/ServiceProxyScript - 200 2497 application/javascript 6.6981ms 2024-11-06 16:15:41 [08:15:41 INF] Executing ContentResult with HTTP Response ContentType of application/javascript 2024-11-06 16:15:41 [08:15:41 INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc) in 12.2878ms 2024-11-06 16:15:41 [08:15:41 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/Abp/ApplicationConfigurationScript - 200 2238 application/javascript 14.2265ms 2024-11-06 16:15:41 [08:15:41 INF] Executing ContentResult with HTTP Response ContentType of application/javascript 2024-11-06 16:15:41 [08:15:41 INF] Executed action Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 19.9231ms 2024-11-06 16:15:41 [08:15:41 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.Localization.AbpApplicationLocalizationScriptController.GetAsync (Volo.Abp.AspNetCore.Mvc)' 2024-11-06 16:15:41 [08:15:41 INF] Request finished HTTP/2 GET https://localhost:5601/Abp/ApplicationLocalizationScript?cultureName=zh-Hans - 200 34688 application/javascript 21.8078ms

docker-compose.yml:

system-web:
    image: reg.biw.com/im/main/system-web:latest
    container_name: system-web
    build:
      context: ../../
      dockerfile: Jee.Im.System/src/Jee.Im.System.Web/Dockerfile
    environment:
      - ASPNETCORE_URLS=https://+:443;http://+:80;      
      - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
      - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc
      - App__SelfUrl=https://localhost:5601
      - RemoteServices__Default__BaseUrl=http://system-api
      - AuthServer__Authority=https://localhost:5200/
      - AuthServer__RequireHttpsMetadata=false
      - AuthServer__ClientId=System_Web
      - AuthServer__ClientSecret=1q2w3e*
      - AuthServer__IsContainerized=true
      - AuthServer__MetaAddress=https://localhost:5200/
      - ConnectionStrings__Default=Server=mysql;Port=3306;Database=im_system;Uid=root;Pwd=123456
      - Redis__Configuration=redis
    ports:
      - "5601:443"
    restart: on-failure
    volumes:
      - ./certs:/root/certificate