ASP.net core Controllers

Hi,

I am developing an ASP.NET Core application. On Windows everything works, but on Ubuntu Core 22, when running the app as a snap, it only works partially. The static files are reachable (wwwroot) and the “app.MapGet(”/api/hello", () => “Hello World!”);" in the Program.cs file is also works. But the controllers what i made are unreachables, i got 404 error. Can someone help what can be the solution?

Here is the snapcarft.yaml file:

name: pdf-config-file
title: PDF Config File Maker
base: core22
version: 1.0.1
#icon: assets/icons/ICONHERE.png
summary: it is pgf config file maker
description: |
  it is pdf config gile maker
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

architectures:
  - build-on: [amd64, arm64]
    build-for: [amd64]
  - build-on: [amd64, arm64]
    build-for: [arm64]

apps:
  app:
    command: pdf_config_file
    daemon: simple
    restart-condition: on-failure
    passthrough:
      restart-delay: 10s
    plugs:
      - network
      - network-status
      - network-bind
      - network-observe
      - active-solution


    environment:
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP
      DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 'true'
      #ASPNETCORE_URLS: http://*:8084
      # Beállítja a tartalom gyökér útvonalát a Snap telepítési útvonalára.
      ASPNETCORE_CONTENTROOT: $SNAP

parts:
  app:
    plugin: dump
    source: ./publish

    # 2. override-prime az engedélyek (jogosultságok) beállításához
    override-prime: |
      snapcraftctl prime
      
      # Futtatási jog megadása a fő alkalmazásnak
      chmod +x $SNAPCRAFT_PRIME/pdf_config_file
      
      # Olvasási jog megadása rekurzívan az összes könyvtárnak és fájlnak
      chmod -R a+rX $SNAPCRAFT_PRIME

# add content plug to webdav
plugs:
  active-solution:
    interface: content
    content: solutions
    target: $SNAP_COMMON/solutions

Here is the build command:

dotnet publish --configuration Release --runtime ${TARGET_DOTNET} --property:PublishDir=${PUBLISH_DIR} --self-contained true /property:GenerateFullPaths=true /property:PublishSingleFile=true /property:PublishTrimmed=false /property:DebugType=None /property:DebugSymbols=false

Please use three backticks ``` above and below pasted text, the way you pasted your snapcraft.yaml makes it completely unreadable …

Alternatively to the three backticks you can as well highlight the pasted text and click the </> icon in the top row of the editor which has the same effect and marks the pasted text as code so the indentation stays intact