Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hello fceci90,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that your ASP.NET 10 Blazor SSR site on Azure Linux App Service B1 is failing with 504.0 Gateway Timeout after deployment, while the same application works immediately on Windows App Service and Windows Server IIS.
This is caused by the Azure Linux App Service container not becoming ready within the platform startup/response window, not by Blazor SSR code itself. This is strongly supported by the fact that the same code works on Windows, but the Linux App Service container waits around 230 seconds and then shuts down. Azure App Service has a platform timeout when the application does not return a timely response, and Linux App Service requires the deployed .NET app to start correctly from the compiled application output. - https://ruslany.net/2019/06/azure-app-service-deployment-slots-tips-and-tricks/, https://appservicesperformance.github.io/2023/05/26/arraffinity/
The best practice for resolution is to:
- Confirm that the Linux App Service is actually using the supported .NET 10 runtime.
- Set the Linux startup command explicitly to the deployed application DLL.
- Ensure Kestrel listens on the expected Linux container HTTP port.
- Enable App Service logs and check the Linux container startup logs.
- If the Linux runtime path remains unstable, temporarily run the app on Windows App Service or publish the app as a self-contained Linux x64 deployment.
After correcting the Linux runtime, startup command, and port binding, the container should respond to the App Service startup probe and the 504.0 Gateway Timeout should stop.
Use the below resources for more reading, validation and steps:
- Configure ASP.NET Core apps in Azure App Service: - https://learn.microsoft.com/en-us/azure/app-service/tutorial-custom-container
- Azure App Service on Linux FAQ and startup command guidance: - https://appservicesperformance.github.io/2023/05/26/arraffinity/
- ASP.NET Core container port change to 8080: - https://medium.com/@g.sowinski/slow-start-of-azure-appservice-on-linux-when-using-a-custom-port-372c11b309f8
- Enable diagnostic logs in Azure App Service: - https://azuretar.com/using-startup-command-to-pass-command-line-arguments-to-azure-app-service-for-linux/
- App Service request timeout behavior: - https://ruslany.net/2019/06/azure-app-service-deployment-slots-tips-and-tricks/
I hope this is helpful! Do not hesitate to let me know if you have any other questions, steps or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.