Open Closed

Deploy abp to docker #1081


0
sgal created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
 2021-03-23 06:38:22.426 +00:00 [INF] Starting Yiki.CoFarm.IdentityServer.
2021-03-23 06:38:24.278 +00:00 [WRN] Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
2021-03-23 06:38:24.280 +00:00 [INF] User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2021-03-23 06:38:24.315 +00:00 [INF] Creating key {bdb6cead-ab9f-47e5-972e-3062c2af2453} with creation date 2021-03-23 06:38:24Z, activation date 2021-03-23 06:38:24Z, and expiration date 2021-06-21 06:38:24Z.
2021-03-23 06:38:24.321 +00:00 [WRN] No XML encryptor configured. Key {bdb6cead-ab9f-47e5-972e-3062c2af2453} may be persisted to storage in unencrypted form.
2021-03-23 06:38:24.324 +00:00 [INF] Writing data to file '/root/.aspnet/DataProtection-Keys/key-bdb6cead-ab9f-47e5-972e-3062c2af2453.xml'.
2021-03-23 06:38:24.368 +00:00 [INF] Loaded ABP modules:
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
......
2021-03-23 06:38:24.369 +00:00 [INF] - Yiki.CoFarm.CoFarmIdentityServerModule
2021-03-23 06:38:24.654 +00:00 [FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Yiki.CoFarm.CoFarmIdentityServerModule, Yiki.CoFarm.IdentityServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> λ:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.. See the inner exception for details.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> λ:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemOptions], Volo.Abp.VirtualFileSystem.IDynamicFileProvider)' on type 'VirtualFileProvider'.
 ---> System.IO.DirectoryNotFoundException: /Yiki.CoFarm.Domain.Shared/
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
   at Volo.Abp.VirtualFileSystem.VirtualFileSetListExtensions.ReplaceEmbeddedByPhysical[T](VirtualFileSetList fileSets, String physicalPath)
   at Yiki.CoFarm.CoFarmIdentityServerModule.<>c__DisplayClass1_0.<ConfigureServices>b__3(AbpVirtualFileSystemOptions options) in /src/aspnet-core/src/Yiki.CoFarm.IdentityServer/CoFarmIdentityServerModule.cs:line 90
   at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
   at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
   at Volo.Abp.VirtualFileSystem.VirtualFileProvider..ctor(IOptions`1 options, IDynamicFileProvider dynamicFileProvider)
   at lambda_method962(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
......

27 Answer(s)
  • 0
    alper created
    Support Team

    this is not related to Docker. Can you run the project in Release mode, it must throw the same exception. it seems like you have an embedded resource in /Yiki.CoFarm.Domain.Shared/ and its path is not correct

  • 0
    sgal created

    I don’t think it’s a problem, the packaged images are all passed. My Dockerfile

    FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
    WORKDIR /app
    EXPOSE 8080
    
    FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
    WORKDIR /src
    COPY ["aspnet-core/src/Yiki.CoFarm.IdentityServer/Yiki.CoFarm.IdentityServer.csproj", "aspnet-core/src/Yiki.CoFarm.IdentityServer/"]
    COPY ["aspnet-core/src/Yiki.CoFarm.EntityFrameworkCore.DbMigrations/Yiki.CoFarm.EntityFrameworkCore.DbMigrations.csproj", "aspnet-core/src/Yiki.CoFarm.EntityFrameworkCore.DbMigrations/"]
    COPY ["aspnet-core/src/Yiki.CoFarm.EntityFrameworkCore/Yiki.CoFarm.EntityFrameworkCore.csproj", "aspnet-core/src/Yiki.CoFarm.EntityFrameworkCore/"]
    COPY ["aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.EntityFrameworkCore/Yiki.CoFarm.Core.EntityFrameworkCore.csproj", "aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.EntityFrameworkCore/"]
    COPY ["aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.Domain/Yiki.CoFarm.Core.Domain.csproj", "aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.Domain/"]
    COPY ["aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.Domain.Shared/Yiki.CoFarm.Core.Domain.Shared.csproj", "aspnet-core/modules/Yiki.CoFarm.Core/src/Yiki.CoFarm.Core.Domain.Shared/"]
    COPY ["aspnet-core/src/Yiki.CoFarm.Domain/Yiki.CoFarm.Domain.csproj", "aspnet-core/src/Yiki.CoFarm.Domain/"]
    COPY ["aspnet-core/src/Yiki.CoFarm.Domain.Shared/Yiki.CoFarm.Domain.Shared.csproj", "aspnet-core/src/Yiki.CoFarm.Domain.Shared/"]
    COPY ["aspnet-core/NuGet.Config", "aspnet-core/"]
    RUN dotnet restore "aspnet-core/src/Yiki.CoFarm.IdentityServer/Yiki.CoFarm.IdentityServer.csproj"
    COPY . .
    WORKDIR "/src/aspnet-core/src/Yiki.CoFarm.IdentityServer"
    RUN dotnet build "Yiki.CoFarm.IdentityServer.csproj" -c Release -o /app/build
    
    FROM build AS publish
    RUN dotnet publish "Yiki.CoFarm.IdentityServer.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "Yiki.CoFarm.IdentityServer.dll"]
    
    
    
  • 0
    sgal created

    I know, this is because the development environment has executed the following code

    if (hostingEnvironment.IsDevelopment())
                {
                    Configure<AbpVirtualFileSystemOptions>(options =>
                    {
                        options.FileSets.ReplaceEmbeddedByPhysical<CoFarmDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Yiki.CoFarm.Domain.Shared", Path.DirectorySeparatorChar)));
                        options.FileSets.ReplaceEmbeddedByPhysical<CoFarmDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Yiki.CoFarm.Domain", Path.DirectorySeparatorChar)));
                    });
                }
    

    But there is no problem with the operation Yiki.CoFarm.IdentityServer and Yiki.CoFarm.Domain.Shared path of COPY in my dockerfile, And I tried the production environment, the problem disappeared

  • 0
    alper created
    Support Team

    And I tried the production environment, the problem disappeared

    do you have still this issue at the moment?

  • 0
    sgal created

    And I tried the production environment, the problem disappeared

    do you have still this issue at the moment?

    I think this may be a problem with the directory separator between different operating systems (/?\)

  • 0
    sgal created

    But there are other problems, identityserver cannot enable https

  • 0
    sgal created
  • 0
    sgal created

    api https:localhost:5001 ids https:localhost:8081

    I have logged in and authorized.

    When I sent a request from swagger UI, the following error appeared

    2021-03-25 03:36:06.665 +00:00 [INF] Request starting HTTP/2 GET https://localhost:5001/abp/Swashbuckle/SetCsrfCookie - -
    2021-03-25 03:36:06.731 +00:00 [ERR] Exception occurred while processing message.
    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.
     ---> System.Net.Http.HttpRequestException: Cannot assign requested address (localhost:8081)
     ---> System.Net.Sockets.SocketException (99): Cannot assign requested address
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
       at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
       at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
       --- End of inner exception stack trace ---
    
  • 0
    sgal created

    They are running in different containers, ids (localhost:8081) cannot be accessed by the API

  • 0
    alper created
    Support Team

    this is a bit out of ABP project context. but to help you; you need to authorize the Swagger client in order to make an authenticated request

  • 0
    sgal created

    I don’t quite understand how to do it, and https://localhost:5001/abp/Swashbuckle/SetCsrfCookie What is it

  • 0
    sgal created

    Now it looks like an ssl problem

    2021-03-25 09:28:41.157 +00:00 [INF] Request starting HTTP/2 GET https://localhost:5001/abp/Swashbuckle/SetCsrfCookie - -
    2021-03-25 09:28:41.214 +00:00 [ERR] Exception occurred while processing message.
    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.
     ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
     ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: PartialChain
       at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
       at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
       at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
       at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
       --- End of inner exception stack trace ---
       at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
       at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
       at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
    
  • 0
    sgal created

    When i put api host https, and AuthServer:Authority host http, it worked. This seems to be a problem with the https request in the container

  • 0
    alper created
    Support Team

    I remember the same thing happened for a customer. He couldn't use HTTPS in the container.

  • 0
    sgal created

    Now I use nginx as the reverse proxy, and similar problems have appeared again. The solution I used before was to deploy the api and identityserver under the same docker network. Is there any other solution?

    2021-03-28 06:53:59.469 +00:00 [ERR] Connection id "0HM7HMONDPRL1", Request id "0HM7HMONDPRL1:00000002": An unhandled exception was thrown by the application.
    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.
     ---> System.Net.Http.HttpRequestException: Connection refused (identityserver.local:80)
     ---> System.Net.Sockets.SocketException (111): Connection refused
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
       at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
    
  • 0
    sgal created

    Under the custom network, they can ping by the container name. However, curl connection refused

  • 0
    sgal created

    I used the domain name to be consistent with the container name and fixed this problem. The container communicates through the container name.

  • 0
    alper created
    Support Team

    thanks for your feedback.

  • 0
    sgal created

    not container name ,actually Aliases (alternative hostnames)

  • 0
    sgal created

    When I deploy to the production environment, this problem still exists

    2021-04-23 09:26:14.799 +00:00 [ERR] Connection id "0HM867749Q1JJ", Request id "0HM867749Q1JJ:00000002": An unhandled exception was thrown by the application.
    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.
     ---> System.Net.Http.HttpRequestException: Connection refused (identity.co-farming.com:443)
     ---> System.Net.Sockets.SocketException (111): Connection refused
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
       at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    
  • 0
    sgal created

    I found this pr: https://github.com/abpframework/abp/commit/c453c53b5c0f52a8486e86ab65695ebddac45c3d

  • 0
    sgal created

    I believe this is bug

    I do not authorize direct access, but the setcsrf request succeeded

  • 0
    alper created
    Support Team

    here's the SetCsrfCookie. https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleController.cs

  • 0
    liangshiwei created
    Support Team

    This is not related to Csrf, I think your application config is not correct

  • 0
    sgal created

    I tried to test locally, the problem still exists, you can send an api request without logging in, and return a successful response

  • 0
    sgal created

    This is not related to Csrf, I think your application config is not correct

    Our focus is different

  • 0
    gterdem created
    Support Team

    When I deploy to the production environment, this problem still exists

    2021-04-23 09:26:14.799 +00:00 [ERR] Connection id "0HM867749Q1JJ", Request id "0HM867749Q1JJ:00000002": An unhandled exception was thrown by the application. 
    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'. 
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'. 
     ---> System.Net.Http.HttpRequestException: Connection refused (identity.co-farming.com:443) 
     ---> System.Net.Sockets.SocketException (111): Connection refused 
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 
       at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 
       at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken) 
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) 
       --- End of inner exception stack trace --- 
       at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) 
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
       at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
    

    If this error still persist, this is related with IdentityServer configuration which is, your api resource can not connect to IdentityServer.

    Check api's Authorization configuration is appsettings match with your production authentication server's url. Most likely it is related with HTTPS.