Search code examples
htmlazureappservice

How to serve static html file on root of Azure App Service?


I created a {my_custom_name}.html file in the wwwroot folder of my App Service. The file contains a string of plain text. I want to make this file accessible from a web browser from the root of the web like this: https://{name}.azurewebsites.net/{my_custom_name}.html

I am always ending on error 404 Not Found. I am sure the file exists in the wwwroot folder. I checked it with Kudu. I also checked if the name of the file is correct in wwwroot folder and also in the web address. Everything seems to be okay, however I am not able to get the context of the file.

My Azure Web App is using .NET 7 (STS).


Solution

  • The issue is with your .NET 7 Core version.

    I don't see any .NET Core 7 option while creating the App Service.

    enter image description here

    • I have tried with the Core 8.
    • You can see the .NET 7 is deprecated.

    enter image description here

    • I am able to access the static file from the root directory without changing any configurations.

    enter image description here

    enter image description here

    • Azure App Service allows you to access any static file which is added in the root directory by default.

    • If you want to access the static file deployed from the local (deployed to Azure App Service from Visual Studio),

    Refer this SOThread which I have answered.