Open Closed

containerizing abp application #1471


0
Neozzz created

I added docker support to a abp application through visual studio. I am having issues setting the environement variable to production as shown below.

When I try to run the application from visual studio by clicking on docker compose button I hit error at ConfigureVirtualFileSystem in HttpApiHostModule.cs.

I have changed the value from development to production in the powershell $env, in the appsettings and launchsettings of the httpapi.host project, changed values in the docker-compose.debug file.

Am I missing some reference?

Also I am trying to enable https but more on that later.

Please help. Thank you


35 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    Maybe you can cancel the ConfigureVirtualFileSystem method call in your web module.

  • 0
    Neozzz created

    I think we need to see how to set the environment variable as production. Right now I have to sign in with my username and password to restore the abp packages. Please see the below steps I did to containerize an abp application. I want to access the container over https at port 44338. Please see the steps below in following thread:

  • 0
    Neozzz created
    1. I added dockercontainer file to the HttpApi.Host project using visual studio by Right click the HttpApi.Host project > Add > Docker Support. I also added container orchestrator support and used docker compose. Please see the files below:

    dockerfile

    FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS base
    WORKDIR /app
    EXPOSE 80
    EXPOSE 443
    EXPOSE 44338
    
    FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build
    SHELL ["/bin/bash", "-c"]
    RUN dotnet tool install --global Volo.Abp.Cli
    WORKDIR /src
    [#2](https://support.abp.io/QA/Questions/2) lines Found from Alper suggestion so that we can stop using abp login in container to restore packages
    COPY ["%UserProfile%\.abp\cli\access-token.bin", "~/.abp/cli/"] 
    COPY ["%UserProfile%\.\AppData\Local\Temp\AbpLicense.bin", "~/.abp/cli/"]
    COPY ["NuGet.Config", ""]
    COPY ["src/ZW.OrgSvc.Application/ZW.OrgSvc.Application.csproj", "src/ZW.OrgSvc.Application/"]
    COPY ["src/ZW.OrgSvc.Application.Contracts/ZW.OrgSvc.Application.Contracts.csproj", "src/ZW.OrgSvc.Application.Contracts/"]
    COPY ["src/ZW.OrgSvc.DbMigrator/ZW.OrgSvc.DbMigrator.csproj", "src/ZW.OrgSvc.DbMigrator/"]
    COPY ["src/ZW.OrgSvc.Domain/ZW.OrgSvc.Domain.csproj", "src/ZW.OrgSvc.Domain/"]
    COPY ["src/ZW.OrgSvc.Domain.Shared/ZW.OrgSvc.Domain.Shared.csproj", "src/ZW.OrgSvc.Domain.Shared/"]
    COPY ["src/ZW.OrgSvc.HttpApi/ZW.OrgSvc.HttpApi.csproj", "src/ZW.OrgSvc.HttpApi/"]
    COPY ["src/ZW.OrgSvc.HttpApi.Client/ZW.OrgSvc.HttpApi.Client.csproj", "src/ZW.OrgSvc.HttpApi.Client/"]
    COPY ["src/ZW.OrgSvc.HttpApi.Host/ZW.OrgSvc.HttpApi.Host.csproj", "src/ZW.OrgSvc.HttpApi.Host/"]
    COPY ["src/ZW.OrgSvc.MongoDB/ZW.OrgSvc.MongoDB.csproj", "src/ZW.OrgSvc.MongoDB/"]
    ENV PATH ~/.dotnet/tools:$PATH
    RUN abp login Neozzz -p <password here without <>>
    RUN dotnet restore "src/ZW.OrgSvc.HttpApi.Host/ZW.OrgSvc.HttpApi.Host.csproj" #--disable-parallel
    COPY . .
    WORKDIR "/src/src/ZW.OrgSvc.HttpApi.Host"
    RUN dotnet build "ZW.OrgSvc.HttpApi.Host.csproj" -c Release -o /app/build
    RUN abp logout
    
    FROM build AS publish
    RUN dotnet publish "ZW.OrgSvc.HttpApi.Host.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "ZW.OrgSvc.HttpApi.Host.dll"]
    

    At this point we have the container to run the application but no https support. Following some tutorials by microsoft I added the following code to to the docker-compose file.

    version: '3.4'
    
    services:
      zw.orgsvc.httpapi.host:
        image: ${DOCKER_REGISTRY-}zworgsvchttpapihost    
        build:
          context: .
          dockerfile: src/ZW.OrgSvc.HttpApi.Host/Dockerfile
        ports: 
            - "44338:44338"
        environment:
        - ASPNETCORE_ENVIRONMENT=Production
        - ASPNETCORE_URLS=https://+:44338;http://+
        - ASPNETCORE_Kestrel__Certificates__Default__Password=password
        - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
        volumes:
        - ~/.aspnet/https:/https:ro
    

    The intension is to expose port 44338 over https. Then I run the following line: docker-compose up --build

    This created the container. But no matter what, the container exits with code 1.

    I am also preparing a document for achieving the same for internal training, once complete with a working example I could share it with you.

    Please let me know if additional steps have to be performed or if I have made mistakes along the way.

    Thank you :)

  • 0
    maliming created
    Support Team

    the container exits with code 1.

    Can you check the container's log? It should have encountered an error.

  • 0
    Neozzz created

    Hi, its not generating any errors. The container stops abruptly. I could share the code with you if you want.

  • 0
    gterdem created
    Support Team

    If you are trying to run the container in Visual Studio using Docker Compose, you need to run on Release.

    You need to check the application logs in order to diagnose the problem but since the container has shut down immidiately, it seems you can't.

    To diagnose the corrupted image:

    run docker ps -a to see your exited container. Sample image below:

    Create new image based on stopped container:

    Overwrite entrypoint to get into the new container:

    Remove the image with docker image rm debug/ubuntu when you are done.

    Follow these steps to navigate into Log folder for logs.txt in your application to see the error.

  • 0
    Neozzz created
    System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
    To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
    For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
       at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
       at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
       at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
       at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable`1 listenOptions, AddressBindContext context)
       at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
       at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
       at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
       at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
       at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
       at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
       at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
       at ZW.OrgSvc.Program.Main(String[] args) in /src/src/ZW.OrgSvc.HttpApi.Host/Program.cs:line 31
    2021-06-21 04:57:13.451 +00:00 [INF] Starting ZW.OrgSvc.HttpApi.Host.
    2021-06-21 04:57:15.367 +00:00 [WRN] Storing keys in a directory '/home/appuser/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
    2021-06-21 04:57:15.374 +00:00 [INF] User profile is available. Using '/home/appuser/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
    


    ``` System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions) at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable`1 listenOptions, AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) 2021-06-21 04:57:17.873 +00:00 [FTL] Host terminated unexpectedly! System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions) at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable`1 listenOptions, AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at ZW.OrgSvc.Program.Main(String[] args) in /src/src/ZW.OrgSvc.HttpApi.Host/Program.cs:line 31 ```

    looks like https issue? Any docs where we config https for abp app in docker?

  • 0
    Neozzz created

    I did the following to setup https. <br>

    dotnet dev-certs https --clean
    
    dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p password
    
    dotnet dev-certs https --trust
    

    <br> Edited the docker-compose.debug.yml file like this: <br>

    version: '3.4'
    
    services:
      zworgsvchttpapihost:
        image: zworgsvchttpapihost
        ports:
            - 44338
            - 443
            - 80
        environment:
        - ASPNETCORE_ENVIRONMENT=Development
        - ASPNETCORE_URLS=https://+:44338;http://+
        - ASPNETCORE_Kestrel__Certificates__Default__Password=password
        - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
        volumes:
        - ~/.aspnet/https:/https:ro
    

    Used the below code to build the container: <br>

    docker-compose -f "docker-compose.debug.yml" up -d
    
  • 0
    gterdem created
    Support Team

    You can check microsoft documentation about Developing ASP.NET Core Applications with Docker over HTTPS.

  • 0
    Neozzz created

    You can check microsoft documentation about Developing ASP.NET Core Applications with Docker over HTTPS.

    Hi, I checked the documentation and I created the container using: docker build . -f .\src\ZW.OrgSvc.HttpApi.Host\Dockerfile -t orgsvc:1

    Then I run the following command to run the container:

    docker run --rm -it -p 44338:44338 -p 80:80 -e "ASPNETCORE_URLS='https://+;http://+'" -e "ASPNETCORE_HTTPS_PORT=44338" -e "ASPNETCORE_ENVIRONMENT=Development" -v "$env:APPDATA\microsoft\UserSecrets\:/root/.microsoft/usersecrets" -v "$env:USERPROFILE\.aspnet\https:/root/.aspnet/https/" orgsvc:1
    

    This doesn't create the container. For reference please take a look at my dockerfile:

    #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
    
    FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
    WORKDIR /app
    EXPOSE 80
    EXPOSE 44338
    
    FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build
    WORKDIR /src
    COPY ["NuGet.Config", ""]
    COPY ["src/ZW.OrgSvc.HttpApi.Host/ZW.OrgSvc.HttpApi.Host.csproj", "src/ZW.OrgSvc.HttpApi.Host/"]
    COPY ["src/ZW.OrgSvc.HttpApi.Client/ZW.OrgSvc.HttpApi.Client.csproj", "src/ZW.OrgSvc.HttpApi.Client/"]
    COPY ["src/ZW.OrgSvc.HttpApi/ZW.OrgSvc.HttpApi.csproj", "src/ZW.OrgSvc.HttpApi/"]
    COPY ["src/ZW.OrgSvc.Application/ZW.OrgSvc.Application.csproj", "src/ZW.OrgSvc.Application/"]
    COPY ["src/ZW.OrgSvc.Application.Contracts/ZW.OrgSvc.Application.Contracts.csproj", "src/ZW.OrgSvc.Application.Contracts/"]
    COPY ["src/ZW.OrgSvc.Domain.Shared/ZW.OrgSvc.Domain.Shared.csproj", "src/ZW.OrgSvc.Domain.Shared/"]
    COPY ["src/ZW.OrgSvc.MongoDB/ZW.OrgSvc.MongoDB.csproj", "src/ZW.OrgSvc.MongoDB/"]
    COPY ["src/ZW.OrgSvc.Domain/ZW.OrgSvc.Domain.csproj", "src/ZW.OrgSvc.Domain/"]
    RUN dotnet tool install --global Volo.Abp.Cli
    ENV PATH /root/.dotnet/tools:$PATH
    RUN echo $PATH
    RUN abp login myUserName -p <my password>
    RUN dotnet restore "src/ZW.OrgSvc.HttpApi.Host/ZW.OrgSvc.HttpApi.Host.csproj"
    COPY . .
    WORKDIR "/src/src/ZW.OrgSvc.HttpApi.Host"
    RUN dotnet build "ZW.OrgSvc.HttpApi.Host.csproj" -c Release -o /app/build
    RUN abp logout
    
    FROM build AS publish
    RUN dotnet publish "ZW.OrgSvc.HttpApi.Host.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "ZW.OrgSvc.HttpApi.Host.dll"]
    

    Please let me know if the dockerfile meets the requirements for abp application. Should I login to download the nuget packages or if I have to put it to release, then can I skip signing in?

    Thank you

  • 0
    gterdem created
    Support Team

    RUN abp login myUserName -p <my password>

    You are copying the Nuget.Config file, it should work without logging in. It should work without using the code above.

  • 0
    Neozzz created

    Hi, Link: https://commitme-my.sharepoint.com/:t:/g/personal/naeem_comm-it_com_sa/Edvj633iLi5CvKauSPRKoX0BaSFTjI_HdXuPBlY0I62Wqw?e=Q4vovS

    I compiled the application using the command: dotnet publish -c Release

    Then containerized it using the following Dockerfile: FROM mcr.microsoft.com/dotnet/aspnet:5.0 COPY bin/Release/net5.0/publish/ App/ WORKDIR /App ENTRYPOINT ["dotnet", "AppName.HttpApi.Host.dll"]

    Then I followed the instructions as given by the link shared earlier: "You can check microsoft documentation about Developing ASP.NET Core Applications with Docker over HTTPS."

    The container exits automatically. Then I followed the steps mentioned in this thread and obtained the log file. I've attached the log file. The following is a small snippet.

    [FTL] Application startup exception Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.AbpAspNetCoreModule, Volo.Abp.AspNetCore, Version=4.3.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 -> ....

    Please let me know what might be causing the issue.

    Thank you.

  • 0
    albert created
    Support Team

    Seems like IWebContentFileProvider cannot be resolved by Autofac. But you have not provided the full exception trace.

  • 0
    Neozzz created

    Please check the onedrive link in the beginning. it contains a file called error.txT which I took from the container.

  • 0
    maliming created
    Support Team

    hi

    You can try to change the environment or remove the ConfigureVirtualFileSystem method in your web module. ASPNETCORE_ENVIRONMENT=Development

  • 0
    Neozzz created

    Hi I commented the : ConfigureVirtualFileSystem(context); in the httpapihostmodule.cs file.

    Now am getting this error: 2021-07-29 20:05:51.090 +00:00 [ERR] ABP-LIC-0008 - License check failed for 'Volo.Abp.LanguageManagement.HttpApi-v4.3.0.0'. You need to log in using the command abp login <username>. For more information, contact to [email protected] 2021-07-29 20:05:51.113 +00:00 [INF] Application is shutting down... 2021-07-29 20:05:51.368 +00:00 [INF] Starting IdentityServer4 version 4.1.1+cebd52f5bc61bdefc262fd20739d4d087c6f961f 2021-07-29 20:05:52.382 +00:00 [INF] Using the default authentication scheme Identity.Application for IdentityServer 2021-07-29 20:05:53.117 +00:00 [INF] Initialized all ABP modules. 2021-07-29 20:05:53.161 +00:00 [FTL] Unable to start Kestrel. System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken)`

    Should we login to abp for running the kestrel application?

  • 0
    maliming created
    Support Team

    hi

    Does the AbpLicenseCode exists in your appsettings.json

  • 0
    Neozzz created

    hi

    Does the AbpLicenseCode exists in your appsettings.json

    Yes. Its there in the appsettings.json. It's also there in the appsettings.json inside the publish folder which we dockerized. There is an empty file called appsettings.Development.json. Should we add anything there? Tx

  • 0
    maliming created
    Support Team

    hi Neozzz

    Please refer to https://support.abp.io/QA/Questions/69/#answer-d8bebebb-b714-3c1e-7fcb-39f437bc8ba3

  • 0
    Neozzz created

    I ran the docker image with the following command.

    docker run -d -p 8000:80 -p 44338:44338 -p 443:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=44338 -e ASPNETCORE_ENVIRONMENT=Production -v C:/Users/neozzz/AppData/Roaming/Microsoft/UserSecrets/:/root/.microsoft/usersecrets -v ${HOME}/.aspnet/https:/root/.aspnet/https/ <myImageName>

    I am still getting errors and now its saying:

    System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action1 configureOptions) at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable1 listenOptions, AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at ZW.OrgSvc.Program.Main(String[] args) in C:\Users\naeem\Desktop\WorkSpace\Repos\ZWApplications\OrganizationService\aspnet-core\src\ZW.OrgSvc.HttpApi.Host\Program.cs:line 31

    Please find the full error logs here.

  • 0
    maliming created
    Support Team

    hi

    Can you check the ms document?

    https://docs.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-5.0

  • 0
    albert created
    Support Team

    @Neozzz,

    working with HTTPS in Docker is not an ABP related issue. you should ask it on the Docker https://github.com/docker

  • 0
    Neozzz created

    Hi I am getting this error from the container logs: 2021-08-16 07:45:09.249 +00:00 [ERR] ABP-LIC-0008 - License check failed for 'Volo.Saas.Domain-v4.3.0.0'. You need to log in using the command abp login <username>.

    I have done the following in the dockerfile COPY ["$env:userprofile.abp\cli\access-token.bin", "~/.abp/cli/"] COPY ["$env:userprofile.abp\cli\access-token.bin", "/root/.abp/cli/"] COPY ["$env:userprofile.\AppData\Local\Temp\AbpLicense.bin", "~/.abp/cli/"]

    I have to run the project as development. Even though I've copied the files as mentioned in other support threads I am still getting this error. Is there any other way to mitigate this issue while running this project as development.

  • 0
    maliming created
    Support Team

    hi

    You can try to login in abp.io in docker instead of copy files.

    https://support.abp.io/QA/Questions/69/#answer-5f2a1969-8dfa-5a54-a51a-39fa557e5b07 https://support.abp.io/QA/Questions/69/#answer-cfdcd2a5-a9cd-dbaa-47ce-39fa521ff5e0

  • 0
    Neozzz created

    Hi, I've tried everything you've said. This is the error I am getting now. I logged in using user account in my docker file.

    Interop+Crypto+OpenSslCryptographicException: error:2006D002:BIO routines:BIO_new_file:system lib at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle) at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)

    Below is my docker run command:

    docker run -d -it -p 5000:80 -p 44338:44338 -e ASPNETCORE_URLS="https://+:44338;http://+" -e ASPNETCORE_HTTPS_PORT=44338 -v $env:USERPROFILE/.aspnet/https:/users/appuser/.aspnet/https/ -v $env:USERPROFILE/AppData/Roaming/Microsoft/UserSecrets/:/users/appuser/.microsoft/usersecrets -e ASPNETCORE_Kestrel__Certificates__Default__Password=password -e ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/aspnetapp.pfx <image name>

    I have tried same method on .net 5.0 application and I was able to successfully use https. When using abp project I am getting this error. Please let me know what to do or if you need further information.

  • 0
    maliming created
    Support Team

    Can you share the full error stack?

  • 0
    Neozzz created

    Please find the full error log in this link.

  • 0
    maliming created
    Support Team

    hi

    It seems the app doesn't have permission to access the PFX file.

  • 0
    Neozzz created

    hi

    this is the same docker command we used with .net 5.0 project.

    How can we mitigate this?

    tx

  • 0
    maliming created
    Support Team

    hi

    Can you try to change the permissions of the pfx file? Or try to run docker with root

  • 0
    Neozzz created

    I have run the app inside container as root. The host system is windows, I dont think there is any permissions I should set, if not please let me know what to do.

    Click here to see the error log when app is run in container as root.

  • 0
    maliming created
    Support Team

    Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file

    BIO_new_file:no such file

    The problem is still with the pfx file, please check whether it exists or its permissions.

    ls -l show the files and permissions.

  • 0
    Neozzz created

    Do you have a dockerfile sample that uses the focal image as mentioned in your other threads.

    Tx

  • 0
    maliming created
    Support Team

    Not yet, none of us are docker experts. We just search solutions on Google. : )

  • 0
    ServiceBot created
    Support Team

    This question has been automatically marked as stale because it has not had recent activity.