How to deploy ASP.NET Core AOT service to Azure App Service?

BlueAzure 0 Reputation points
2024-08-30T20:07:33.01+00:00

I made a simple ASP.NET Core AOT web app by using the Visual Studio 2022 template. It just shows a list of ”to-do” items when I run it inside the Visual Studio (so, it works). Then I created an Azure web app (App Service), and followed all the steps to publish an AOT here: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net7%2Cwindows . Then I followed all the steps to publish ASP.NET Core from here: https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-8.0 . I made sure it is x64, .NET 8.0 and that my App Service also is x64 and .NET 8.0. When I published it via Visual Studio 2022, it succesfully copied the AOT exe file to my wwwroot, but when I try to visit the website, it just shows the default Azure notification ”waiting for content” (and I did wait for 20 minutes and refreshed the page).

I’ve been banging my head to the wall with this for nearly 12 hours now straight, and cannot understand how to deploy ASP.NET Core AOT apps to Azure app service. There doesn’t seem to be any good documentation available on the subject.

Please, help!

Developer technologies ASP.NET ASP.NET Core
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-08-30T21:40:59.9433333+00:00

    ASP.NET Core AOT output is an executable, not a loadable dll. so azure app service must be configured to proxy to the exe like a node application. this is not a standard asp.net core configuration, so you probably need to use docker deployment instead:

    https://azure.microsoft.com/en-us/products/app-service/containers?activetab=pivot:deploytab

    note: while you can build a dll with AOT, it not a .net dll, but rather a native c/c++ dll with c/c++ calling conventions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.