Open Closed

Failed to load API definition - 500 Internal Server Error on the /api/abp/application-configuration - Fetch error OK /swagger/v1/swagger.json #10358


User avatar
0
devchase321 created

Hello,

We are facing Error 500 issues with API after deploying to Azure Container App. Same application using appsettings.development.json config runs fine locally. We need your help spotting any misconfigured on our end.

Failed to load API definition - 500 Internal Server Error on the /api/abp/application-configuration - Fetch error OK /swagger/v1/swagger.json

More details - source files here: https://drive.google.com/drive/folders/1P88jaMPzPbPd9HLima4ZEj1HF-GUHu9H?usp=drive_link

ABP Studio Configuration Information:

  • Template: app
  • Created ABP Studio Version: 2.1.0
  • Current ABP Studio Version: 2.1.7
  • Tiered: Yes
  • Multi-Tenancy: Yes
  • UI Framework: blazor-server
  • Theme: leptonx
  • Theme Style: system
  • Theme Menu Placement: side
  • Database Provider: ef
  • Database Management System: sqlserver
  • Separate Tenant Schema: Yes
  • Mobile Framework: none
  • Public Website: Yes
  • Social Login: Yes
  • Include Tests: Yes
  • Kubernetes Configuration: Yes
  • Distributed Event Bus: rabbitmq
  • Use Local References: No
  • Optional Modules:
    • GDPR
    • FileManagement
    • TextTemplateManagement
    • LanguageManagement
    • AuditLogging
    • Chat
    • OpenIddictAdmin
  • Selected Languages: English, French, Spanish
  • Default Language: English
  • Create Command: abp new Millennial -t app --tiered --ui-framework blazor-server --database-provider ef --database-management-system sqlserver --theme leptonx --separate-tenant-schema --skip-migration --skip-migrator --public-website --without-cms-kit --dont-run-install-libs --dont-run-bundling -chat -file-management

What we have tried: Validated OpenIddict Application values in DB and Admin console Validated values in AppSettings.json files


35 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution

    In ABP applications, both:

    • /api/abp/application-configuration
    • /swagger/v1/swagger.json

    are among the very first endpoints that hit all your infrastructure (DB, Redis, distributed cache, OpenIddict, etc.).
    After deployment to Azure Container Apps, a 500 here almost always means environment‑specific configuration (especially Redis / cache / connection strings / certificates) is wrong.

    Below is a concrete checklist that matches your scenario (tiered, Redis/RabbitMQ, containers) and what we’ve seen in similar ABP support tickets.


    1. Check the real exception in the API logs

    First, get the HttpApi.Host container logs and look for the first stack trace that appears when you call:

    • https://<your-api>/api/abp/application-configuration
      or
    • https://<your-api>/swagger/v1/swagger.json

    Typical failing components in production/container environments:

    • Redis / distributed cache
    • Data Protection (Redis or key ring)
    • OpenIddict certificate loading
    • Wrong DB connection string

    Until you see that exception, the front-end 500/“Failed to load API definition” is just a symptom.


    2. Fix Redis / distributed cache configuration (most common cause)

    In container / cloud environments, bad Redis configuration will crash application-configuration and Swagger.

    In HttpApi.Host’s environment appsettings (for example appsettings.Production.json or the environment you set in ASPNETCORE_ENVIRONMENT), you should have something like:

    {
      "Redis": {
        "Configuration": "your-redis-name.redis.cache.windows.net:6380,password=YOUR_PRIMARY_KEY,ssl=True,abortConnect=False"
      },
    
      "DistributedCache": {
        "KeyPrefix": "Millennial:"
      }
    }
    

    Key points:

    • Use the full Azure Cache for Redis connection string, not just host:port.
    • Make sure the port is 6380 with ssl=True in Azure.
    • Apply the same configuration in:
      • HttpApi.Host (appsettings.<env>.json)
      • DbMigrator (appsettings.<env>.json)
      • Any other service using Redis (AuthServer, Background workers, etc.) if present.

    If you don’t actually have Redis in the Azure environment yet:

    • Either provision Azure Cache for Redis and configure as above, or
    • Disable Redis usage in your solution (remove AbpRedisCache / Redis DataProtection config, and use in‑memory cache for now).

    A misconfigured Redis (wrong address or missing password) will usually show errors like:

    • NOAUTH Authentication required
    • socket / timeout / connection refused errors to Redis host

    These will appear in the API logs right before the 500 on /api/abp/application-configuration.


    3. Make sure the environment name matches your appsettings

    If your Container App has:

    ASPNETCORE_ENVIRONMENT=Production
    

    then the app will use:

    • appsettings.json
    • appsettings.Production.json

    Common mistakes:

    • Configured Redis, DB, URLs only in appsettings.Staging.json / appsettings.Development.json, but container runs with Production.
    • Or vice versa.

    Ensure the environment you set in Azure Container Apps matches the file where you placed your production settings.


    4. Verify App / Auth URLs for tiered Blazor Server

    In the HttpApi.Host appsettings for your deployment environment:

    {
      "App": {
        "SelfUrl": "https://<your-api-container-url>"
      },
      "AuthServer": {
        "Authority": "https://<your-auth-server-url-or-api-url>",
        "RequireHttpsMetadata": "true"
      },
      "CorsOrigins": "https://<your-blazor-server-url>,https://<your-public-web-url>"
    }
    

    In the Blazor Server appsettings for the same environment:

    {
      "RemoteServices": {
        "Default": {
          "BaseUrl": "https://<your-api-container-url>"
        }
      },
      "AuthServer": {
        "Authority": "https://<your-auth-server-url-or-api-url>",
        "RequireHttpsMetadata": "true"
      }
    }
    

    Wrong urls typically cause 401/403, not 500, but if some auth/URL‑dependent configuration runs during Application Configuration, it can contribute to failures. Validate them anyway.


    5. OpenIddict certificates in containers (if your AuthServer is in the same app)

    In containerized / Azure environments, development certificates like AddDevelopmentEncryptionAndSigningCertificate cannot be used reliably. For OpenIddict you should:

    In your AuthServer (or the auth-host) module’s PreConfigureServices:

    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        var env = context.Services.GetHostingEnvironment();
    
        if (!env.IsDevelopment())
        {
            PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
            {
                options.AddDevelopmentEncryptionAndSigningCertificate = false;
            });
    
            PreConfigure<OpenIddictServerBuilder>(builder =>
            {
                builder.AddProductionEncryptionAndSigningCertificate(
                    "openiddict.pfx",
                    Environment.GetEnvironmentVariable("OPENIDDICT_CERT_PASSWORD"));
    
                // optional: set token lifetimes as needed
            });
        }
    }
    

    Then:

    • Mount openiddict.pfx into the container (volume or file copy at build/publish).
    • Set the password via an environment variable or Azure secret.

    If certificates are misconfigured, you’ll see CryptographicException: Keyset does not exist or similar in logs. That can also result in 500s when the app tries to build application configuration (because auth/validation configuration fails).


    6. Summary of what to do right now

    1. Get the HttpApi.Host container logs and find the first exception when hitting /api/abp/application-configuration.
    2. Fix Redis configuration in all appsettings for the deployment environment using the full Azure connection string.
    3. Ensure ASPNETCORE_ENVIRONMENT in Azure matches the appsettings <env> you edited.
    4. Verify App:SelfUrl, AuthServer:Authority, RemoteServices:Default:BaseUrl, and CorsOrigins for your Blazor Server + API + AuthServer.
    5. If using OpenIddict in that environment, use a production PFX certificate rather than development certs.

    Once the infrastructure configuration (especially Redis and connection strings) is correct, /api/abp/application-configuration returns 200 and Swagger will load again.


    1. Sources
    • Application Configuration endpoint reference
      (explains the /api/abp/application-configuration API and its role)
      https://abp.io/docs/latest

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    devchase321 created

    i already check these possible solutions but it cant work

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the logs.txt of 500 Internal Server Error ?

    We need to see what the error is.

    Thanks

  • User Avatar
    0
    devchase321 created

    I added the logs.txt file to the Google Drive

  • User Avatar
    0
    devchase321 created

    Request URL https://api.millennialinformatics.com/api/abp/application-configuration Request Method GET Status Code 500 Internal Server Error Remote Address 20.161.226.4:443 Referrer Policy strict-origin-when-cross-origin

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the full logs.txt with the debug level

    https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems

    Thanks

  • User Avatar
    0
    devchase321 created

    Please check now, file name: api.millennialinformatics.com.har

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the Logs.txt file?

    var loggerConfiguration = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
        .Enrich.FromLogContext()
        .WriteTo.Async(c => c.File("Logs/logs.txt"))
    

    Thanks

  • User Avatar
    0
    devchase321 created

    Could you please check now - Google Drive for Logs.txt - I wanted to make sure it is the Logs from Azure App

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    It seems your Redis server is not working.

    Can you check that Redis is connectable and working?

    Thanks.

  • User Avatar
    0
    devchase321 created

    I restarted redis and it is working now - thanks

  • User Avatar
    0
    devchase321 created

    Actually it partially resolved issues - I have added more screenshot to the Google Drive - Do you think it is still redis? filename "Error500 Screenshots22"

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please delete the Logs.txt then start your app and reproduce the 500 error and share the Logs.txt again. Thanks.

  • User Avatar
    0
    devchase321 created

    Please see it here: https://drive.google.com/file/d/1o2bLhleUmQgq8zZttKxEqFL85Mcm9Npz/view?usp=drive_link

  • User Avatar
    0
    devchase321 created

    hi, let me know if you got the latest logs - I am using azure container app for redis

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There are no error logs in your latest logs.txt. And the log level is not DEBUG

    var loggerConfiguration = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
        .Enrich.FromLogContext()
        .WriteTo.Async(c => c.File("Logs/logs.txt"))
    
  • User Avatar
    0
    devchase321 created

    Hi @maliming - please check Google Drive for latest logs 1-28Logs.txt

  • User Avatar
    0
    devchase321 created

    Hi, please see the file here: https://drive.google.com/file/d/18lvGQ-s2otEocF51CPTnKRkbJF4REb50/view?usp=drive_link

    thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The logs show your Redis Server has problem. Can you check and make sure your Redis is working?

    Thanks.

  • User Avatar
    0
    devchase321 created

    Hi, We have installed fresh Redis (Azure Cache for Redis) and everything seems fine with Redis and other application uses it and runs fine. But the 500 Error issue still persist. I have added latest logs again. Please assist. Thanks

    https://drive.google.com/file/d/1FggJACSFaApPeQxrI52VOCLLVrTKOKk9/view?usp=drive_link

  • User Avatar
    0
    devchase321 created

    What to do about this: 2026-01-26 03:30:57.531 +00:00 [ERR] The access_token is not active.

    2026-01-26 03:30:57.461 +00:00 [DBG] HealthReportCollector - health report execution history saved. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthReportCollector has completed. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthCheck collector HostedService executed successfully. 2026-01-26 03:30:57.531 +00:00 [ERR] The access_token is not active. 2026-01-26 03:30:57.532 +00:00 [INF] AuthenticationScheme: Cookies signed out. 2026-01-26 03:30:57.532 +00:00 [INF] Cookies was not authenticated. Failure message: No principal. 2026-01-26 03:30:57.532 +00:00 [INF] Executing endpoint '/Blog' 2026-01-26 03:30:57.532 +00:00 [INF] Route matched with {page = "/Blog", action = "", controller = "", area = ""}. Executing page /Blog 2026-01-26 03:30:57.532 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2026-01-26 03:30:57.533 +00:00 [INF] Executing handler method Millennial.Web.Public.Pages.BlogModel.OnGetAsync - ModelState is "Valid" 2026-01-26 03:30:57.533 +00:00 [INF] Executed handler method OnGetAsync, returned result . 2026-01-26 03:30:57.533 +00:00 [INF] Executing an implicit handler method - ModelState is "Valid"

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you remove the existing logs.txt, reproduce the error, and share it again?

    The current log file is too big.

    Thanks.

  • User Avatar
    0
    devchase321 created

    [devchase321] said: What to do about this: 2026-01-26 03:30:57.531 +00:00 [ERR] The access_token is not active.

    2026-01-26 03:30:57.461 +00:00 [DBG] HealthReportCollector - health report execution history saved. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthReportCollector has completed. 2026-01-26 03:30:57.461 +00:00 [DBG] HealthCheck collector HostedService executed successfully. 2026-01-26 03:30:57.531 +00:00 [ERR] The access_token is not active. 2026-01-26 03:30:57.532 +00:00 [INF] AuthenticationScheme: Cookies signed out. 2026-01-26 03:30:57.532 +00:00 [INF] Cookies was not authenticated. Failure message: No principal. 2026-01-26 03:30:57.532 +00:00 [INF] Executing endpoint '/Blog' 2026-01-26 03:30:57.532 +00:00 [INF] Route matched with {page = "/Blog", action = "", controller = "", area = ""}. Executing page /Blog 2026-01-26 03:30:57.532 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2026-01-26 03:30:57.533 +00:00 [INF] Executing handler method Millennial.Web.Public.Pages.BlogModel.OnGetAsync - ModelState is "Valid" 2026-01-26 03:30:57.533 +00:00 [INF] Executed handler method OnGetAsync, returned result . 2026-01-26 03:30:57.533 +00:00 [INF] Executing an implicit handler method - ModelState is "Valid"

    Hi i check for redis and rabbit mq its working fine the main issue is when i click login form Public App or Admin App it cant redirect us to auth server and it find login page on Public app url or Admin app url so i cant understand this issue and local is working fine.

    And i also uploaded new log file on Google drive

  • User Avatar
    0
    devchase321 created

    Hi i check for redis and rabbit mq its working fine the main issue is when i click login form Public App or Admin App it cant redirect us to auth server and it find login page on Public app url or Admin app url so i cant understand this issue and local is working fine.

    And i also uploaded new log file on Google drive

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Volo.Abp.AbpException: Could not find file '~/js/swiper.js'

    Please check your js file.

    Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on January 30, 2026, 08:56
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.