Starts in:
2 DAYS
0 HR
27 MIN
22 SEC
Starts in:
2 D
0 H
27 M
22 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?

Consider the case of a bookstore where 1 author can have many books and 1 book can have many authors. At the time of creation of books, we add the authors. We are assuming that the books being entered have unique authors, hence we are not fetching authors and then relating to the book entity. . Let us consider the following Author and book entity classes in the domain layer.

public class Book : AuditedAggregateRoot<Guid>
    {
        public string Name { get; set; }

        public BookType Type { get; set; }

        public DateTime PublishDate { get; set; }

        public float Price { get; set; }

        //Nav property
        public ICollection<Author> Authors { get; } = new List<Author>();

        private Book()
        {
            //ORM stuff
        }
//Other methods to insert and change are written. I’ve added a method to map authors as well.
private void MapAuthors(ICollection<AuthorReverse> authors)
        {
            var authorsList = new List<Author>();
            foreach(var x in authors )
            {
                
                Authors.Add(new Author(Guid.NewGuid(), x.Name, x.BirthDate, null, x.ShortBio));
            }
        }
}

The above MapAuthors method is used inside the bookManager class and we’re using a AuthorReverse class in the common namespace under the domain.shared project to assign values between layers as the domain entities have private constructors, the accessibility is only through its methods. I want to know if this mapping would actually work in real time.

Let’s see the author entity class.

public class Author : FullAuditedAggregateRoot<Guid>
    {
        public string Name { get; private set; }
        public DateTime BirthDate { get; set; }
        public string ShortBio { get; set; }

        //Nav property
        public virtual ICollection<Book> Books { get; set; }

        private Author()
        {
            /* This constructor is for deserialization / ORM purpose */
        }
}//other similar code in book follows.

When I hit the api I get the following error from the logs:

2021-06-18 09:51:55.557 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44319/api/app/book application/json 152 - 400 - - 238.6686ms
2021-06-18 09:52:38.249 +04:00 [INF] Request starting HTTP/2 POST https://localhost:44319/api/app/book application/json 152
2021-06-18 09:52:38.253 +04:00 [INF] No CORS policy found for the specified request.
2021-06-18 09:52:38.253 +04:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:572d895c-6fec-4eb2-b140-39fd2011486f,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] Found in the cache: pn:U,pk:572d895c-6fec-4eb2-b140-39fd2011486f,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] Found in the cache: pn:R,pk:admin,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [INF] Authorization was successful.
2021-06-18 09:52:38.256 +04:00 [INF] Executing endpoint 'Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application)'
2021-06-18 09:52:38.256 +04:00 [INF] Route matched with {action = "Create", controller = "Book", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Acme.BookStore.Books.BookDto] CreateAsync(Acme.BookStore.Books.CreateUpdateBookDto) on controller Acme.BookStore.Books.BookAppService (Acme.BookStore.Application).
2021-06-18 09:52:38.256 +04:00 [ERR] The required antiforgery header value "RequestVerificationToken" is not present.
2021-06-18 09:52:38.256 +04:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
2021-06-18 09:52:38.257 +04:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400
2021-06-18 09:52:38.257 +04:00 [INF] Executed action Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application) in 0.7605ms
2021-06-18 09:52:38.257 +04:00 [INF] Executed endpoint 'Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application)'
2021-06-18 09:52:38.264 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-06-18 09:52:38.264 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-06-18 09:52:38.265 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44319/api/app/book application/json 152 - 400 - - 15.9554ms

This is in spite of adding the following to the appsettings.json in the web project.

The database migrations have created the expected structure of 3 tables.

Please let me know a. why are we facing this cors issue b. is it recommended to have many to many relationship on entities that uses private constructors and use manager classes.

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:

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

The FileAppService is as shown below:

The IFileAppService is as shown below:

The File APIs formed are as shown below:

What might be the reason why the id fields shown before the name of the entity? Please let me know if I am missing something.

Thank you

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.

Showing 101 to 110 of 128 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06