Azure Web App Error: You do not have permission to view this directory or page

In this Azure blog post, We will show you how to resolve the Azure Web App Error: You do not have permission to view this directory or page.

Before we get to the solution, this error usually happens when we try to deploy an ASP.NET Web Application to Azure from VS Code (shown below).

When we use the Deploy to Web App menu, VS Code code copies the folder of the application’s directory to the Web App.

The problem is that VS Code only copied the files, not the .dll file, which the ASP.NET app needs to use to run the application.

To deploy and run an ASP.NET application on Azure Web App, we need to deploy the actual . DLL (published file) of the application.

Solution #1 – Publish application

To resolve the issue, we must first publish the application using the dotnet publish command.

The command will create a runtime file as a .DLL, allowing the Web App service to run it as an executable. From VS Code, use the following command.

dotnet publish -c Release -o ./bin/Publish

Right-click on the Publish folder

Select Deploy to Web App…

Solution #2 – Use Visual Studio

To fix the issue, Use Visual Studio (not VS Code) and use the Publish option to publish your application to Azure.

In the last deployment screen, make sure you tick the box Deploy as a Zip package.

The result will be that Visual Studio will create a .DLL file for your application.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.