ardalis / CleanArchitecture

Clean Architecture Solution Template: A starting point for Clean Architecture with ASP.NET Core
MIT License
15.19k stars 2.66k forks source link

404 when launching the project #730

Open sdudnic-ingerop opened 2 months ago

sdudnic-ingerop commented 2 months ago

Steps to Reproduce:

  1. Obtain the latest (at day 22/04/2024) version of the main branch

  2. Run it

    PS C:\proj\CleanArchitecture> dotnet run --project .\src\Clean.Architecture.Web\           
    Building...
    C:\Program Files\dotnet\sdk\8.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(284,5): warning NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): win7-x64, win7-x86
    ed libraries: SQLite. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details. [C:\proj\Cl
    tecture\src\Clean.Architecture.Infrastructure\Clean.Architecture.Infrastructure.csproj]
    C:\Program Files\dotnet\sdk\8.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(284,5): warning NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): win7-x64, win7-x86
    ed libraries: SQLite. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details. [C:\proj\Cl
    tecture\src\Clean.Architecture.Web\Clean.Architecture.Web.csproj]
    [12:11:22 INF] Starting web host
    [12:11:22 INF] Infrastructure services registered
    [12:11:23 INF] Registered 5 endpoints in 303 milliseconds.
    [12:11:24 INF] Executed DbCommand (14ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT COUNT(*) FROM "sqlite_master" WHERE "type" = 'table' AND "rootpage" IS NOT NULL;
    [12:11:24 INF] Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT EXISTS (
    SELECT 1
    FROM "Contributors" AS "c")
    [12:11:24 ERR] Hosting failed to start
    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'.
  3. add certificate

    PS C:\proj\CleanArchitecture> dotnet dev-certs https
    The HTTPS developer certificate was generated successfully.
    PS C:\proj\CleanArchitecture> dotnet run --project .\src\Clean.Architecture.Web\
    Building...
    [12:12:03 INF] Starting web host
    [12:12:03 INF] Infrastructure services registered
    [12:12:03 INF] Registered 5 endpoints in 310 milliseconds.
    [12:12:04 INF] Executed DbCommand (13ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT COUNT(*) FROM "sqlite_master" WHERE "type" = 'table' AND "rootpage" IS NOT NULL;
    [12:12:04 INF] Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT EXISTS (
    SELECT 1
    FROM "Contributors" AS "c")
    [12:12:04 WRN] The ASP.NET Core developer certificate is not trusted.
  4. Trust it, to get 404:

    PS C:\proj\CleanArchitecture> dotnet dev-certs https --trust
    Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
    [12:18:16 INF] Registered 5 endpoints in 286 milliseconds.
    [12:18:16 INF] Executed DbCommand (12ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT COUNT(*) FROM "sqlite_master" WHERE "type" = 'table' AND "rootpage" IS NOT NULL;
    [12:18:17 INF] Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT EXISTS (
    SELECT 1
    FROM "Contributors" AS "c")
    [12:18:17 INF] Now listening on: https://localhost:57679
    [12:18:17 INF] Application started. Press Ctrl+C to shut down.
    [12:18:17 INF] Hosting environment: Development
    [12:18:17 INF] Content root path: C:\proj\CleanArchitecture\src\Clean.Architecture.Web
    [12:18:20 INF] Request starting HTTP/2 GET https://localhost:57679/ - null null
    [12:18:20 INF] Request finished HTTP/2 GET https://localhost:57679/ - 404 0 null 44.1202ms
  5. Relaunch the project, however it gets 404:

    PS C:\proj\CleanArchitecture> dotnet run --project .\src\Clean.Architecture.Web\
    Building...
    [15:48:07 INF] Starting web host
    [15:48:07 INF] Infrastructure services registered
    [15:48:08 INF] Registered 5 endpoints in 261 milliseconds.
    [15:48:08 INF] Executed DbCommand (13ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT COUNT(*) FROM "sqlite_master" WHERE "type" = 'table' AND "rootpage" IS NOT NULL;
    [15:48:09 INF] Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    SELECT EXISTS (
    SELECT 1
    FROM "Contributors" AS "c")
    [15:48:09 INF] Now listening on: https://localhost:57679
    [15:48:09 INF] Application started. Press Ctrl+C to shut down.
    [15:48:09 INF] Hosting environment: Development
    [15:48:09 INF] Content root path: C:\proj\CleanArchitecture\src\Clean.Architecture.Web
    [15:48:12 INF] Request starting HTTP/2 GET https://localhost:57679/ - null null
    [15:48:12 INF] Request finished HTTP/2 GET https://localhost:57679/ - 404 0 null 40.9296ms
    [15:48:12 INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://localhost:57679/, Response status code: 404
ardalis commented 2 months ago

Yeah I need to update it to use swagger as its home page or just not launch a browser. The way I typically use it today is via the .http file in the root of the web project.

sdudnic-ingerop commented 2 months ago

Yeah I need to update it to use swagger as its home page or just not launch a browser. The way I typically use it today is via the .http file in the root of the web project.

can we add such a sample file in the solution?