Open Closed

Application not working when published to a remote server - Blazor Application can´t connect to API endpoint #3360


User avatar
0
chrisalves created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.3.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: Blazor Server receiving error message 500 when trying to access the Aplication API
  • Steps to reproduce the issue:" To create an application using ABP Suite, select "Application Template", UI Framework "Blazor WebAssembly", Mobile "React Native", Database "Entity Framework Core", Database SQL, check "Public Website", check "Cms-Kit", check "Separeted Tenant Schema" and check "Progressive Web Application". Build the solution and run locally in the PC to to ensure it runs locally perfectly. Prepare the projects to be published using Visual Studio to remote servers (I´m using Azure WebApp) setting them up by the appsettings.json file in Blazor Projetct, DB Migration and HostAPI project changing the URL of the new web servers. Define the remote servers with configuration settings for ASPNETCORE_ENVIRONMENT=Staging to define the environment name, the same used by the projects".

I will present the settings prepared to publish the application. No sensitive information.

appsettings.json file for Blazor project is presented below containing the new Blazor and HttpApi.Host endpoints.

appsettings.json file for HttpApi.Host project is presented below containing the CorsOrigins and RedirectAllowedUrls containg the Blazor endpoint.

appsettings.json file for DbMigrator project is presented below, with the endpoints for Blazor and the API defined for the remote servers.

After the publish is done, the Swagger runs fine, so the API endpoint seems to be well configured as presented below:

But the Blazor front end is loading endless as presented below:

I´ve already rebuilt the application to avoid mistakes. I searched on the web, also on the ABP support and community and reviewed the settings. I found many other folks having the same issue reported in the support and comunity. I believe there is a trick that is missed by blog authors on community also in the answers from support tickets found.

Here is the symptons found using the "Dev tools" available in the Google Chrome browser:

here is an additional information on the "network" available in the "Dev tools" presenting many failures:

Here is the check-point about the endpoint being pointed correctly by the Blazor app:

Here are the detailed screens that might be the problem: Screen 1:

Screen 2:

Screen 3:

Screen 4:

I´m really blocked for a long time trying to find a solution by myself but I was not able to find what is going wrong with the settings.

Please help on this! 😊

Best Regards,

Christian

<br> <br> <br>


7 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    On screenshot 3 you get 500 error. Can you share the related error logs of azureappapi-staging. The logs can be found under the Logs folder with the name logs.txt

  • User Avatar
    0
    chrisalves created

    On screenshot 3 you get 500 error. Can you share the related error logs of azureappapi-staging. The logs can be found under the Logs folder with the name logs.txt

    Hi! Thanks for you return. I took longer because I was trying to find a root cause, but I found in the log some traces of Redis Cache endpoint requesting the credentials. The log.txt file is available in the URL from my Azure blog storage (public access for read/download) https://sasdsupport.blob.core.windows.net/serverlogs/azureappapi-staging-logs.txt Below I present a cut of the log file where I found Error message and the Systems Exception related. I believe it is required to pass the credentials, but I did not find how to do this. Additionally, I found in Azure Redis Cache Service a connection string to be used by the application, so if it is possible to pass the connection string, it also can be a trial for the solution.

    <br>

    Additionally, I found these options on Azure Redis Cache available for usage, but I do not know how to apply it on ABP.IO I hided the Primary and Seondary secrets, but I belive we need to use the connection string in ABP.IO.

    I tried to replace the Redis Cache "Configuration" in the appsettings.json with the AzureApp-Cache connection string but after this, the Swagger doesn´t load and gets error. I´ve tried to add only the password after the Redis Server separeted by Comma, but it also did not work.

    Please, give a help! 😊

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    the Swagger doesn´t load and gets error.

    What are the error logs?

    https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/cache-dotnet-how-to-use-azure-redis-cache

  • User Avatar
    0
    chrisalves created

    Hi Maliming, I reported an error about the ABP tool created with ABP Suite, using the ABP default process, and it is not working on the remote servers. Someone in the Support side requested to submit the Log to investigate what can be the error. You are sending an Article from Microsoft and I do not understand the why you are sending this article for me, because the Azure Cache is configured correctly. The problem is certainly related to the configuration of ABP application side, and there is not information on how to configure the application to run correctly with the Azure Redis Cache. Please send to this ticket the step by step process to make configure the Redis Cache, what shoud be done in the ABP Commercial/framework, to allow the applicatioin works correctly.

    Thanks,

    Christian

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The article is for your refer.

    I tried to replace the Redis Cache "Configuration" in the appsettings.json with the AzureApp-Cache connection string but after this, the Swagger doesn´t load and gets error. I´ve tried to add only the password after the Redis Server separeted by Comma, but it also did not work.

    Please share the related error logs.

  • User Avatar
    0
    chrisalves created

    hi

    I tried to replace the Redis Cache "Configuration" in the appsettings.json with the AzureApp-Cache connection string but after this, the Swagger doesn´t load and gets error. I´ve tried to add only the password after the Redis Server separeted by Comma, but it also did not work.

    Please share the related error logs.

    Hi Maliming, Thanks for your return. Here is the new log, containing data from today (July 6th, 2022): https://sasdsupport.blob.core.windows.net/serverlogs/azureappapi-staging-logs-2022-07-06.txt

    I´ve made some tentatives to solve. I updated the solution files to ABP Commercial 5.3.1 including all packages using the ABP Suite feature as you can see in the CLI outputs:

    After this, I build the entire solution using Visual Studio 2022.

    After this I updated the Redis Configuration in file appsettings.json as presented in the picture below.

    I´m not sure what is the root cause, I believe it could be the version of ABP. Now the Application is working.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11