Starts in:
2 DAYS
1 HR
59 MIN
21 SEC
Starts in:
2 D
1 H
59 M
21 S

Activities of "Neozzz"

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
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?

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

  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://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 :)

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:

Sorry, but I want say, please share the API Host application logs, the logs you provided is not useful.

Hi, the file i shared is from the logs folder inside http api host project folder. could you please let me know where is the file that youre looking for? thank you

hi, i hope you were able to get the file from the link.

Hi,

I mean the application error log : ).
Hi, Please find the below link to the log file in the httpapi.host project.

https://commitme-my.sharepoint.com/:t:/g/personal/naeem_comm-it_com_sa/Eb8xKWHKJ6tNvmx3KaVc57gBPGpxCD6uEdzkBZM7sQz3cA?e=ZUXRHk

Thank you :)

Hi,

Can you share the error stack? thanks.

{ "userId": "dcf37353-fc1d-0bb5-e820-39fc86c50a1e", "userName": "admin", "tenantId": null, "impersonatorUserId": null, "impersonatorTenantId": null, "executionTime": "2021-06-01T07:19:20.16Z", "executionDuration": 5, "clientIpAddress": "::1", "clientName": null, "browserInfo": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Edg/90.0.818.66", "httpMethod": "POST", "url": "/api/app/company-branch", "exceptions": "", "comments": "", "httpStatusCode": 500, "applicationName": null, "correlationId": "6625a18b1f1747a7a1fdb7e7664ccfab", "entityChanges": [], "actions": [], "id": "e6ecd896-becd-ad49-8f8c-39fcd89dc565", "extraProperties": {} }

Please let me know if this is what you wanted.
Thank you

hi. please update. thank you.

Showing 91 to 100 of 108 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06