Troubleshooting 403.14 Forbidden Error with Default Blazor Template deployed as Azure App Service

letivalo 20 Reputation points
2024-08-24T21:27:10.0733333+00:00

Background:

I'm a relatively novice programmer and I've been experimenting with creating my own Blazor app and hosting it on Azure for the first time. I've had success creating SWAs on Azure before with Blazor, but my current project is a small demo of a to-do app, so I've been trying to create my first App Service. After little luck in deploying my current project, I decided to start from scratch by deploying the default Blazor template as an App Service to see if I could isolate what was going wrong, and what gaps there were any gaps in my own background knowledge.

Steps Taken:

  1. Project Initialization:
    • Created a new Blazor project targeting .NET 8.0 with the command:
           
           dotnet new blazor -int auto -n FirstBlazorDeploy
           
      
    • Opened the project in Visual Studio 17.11.11 and pushed it to a new GitHub repository.
  2. Deployment Setup in Visual Studio:
    • Navigated to Build > Publish and selected "Azure App Service (Windows)" as the target.
    • Configured a new app service in a unique resource group with default settings.
    • Set Deployment Type to CI/CD GitHub.
  3. GitHub Actions and Deployment:
    • Monitored the GitHub action until it completed and deployed successfully.
    • Upon accessing the deployed site's URL, I encounter a 403.14 Forbidden error, looking at the log stream on Azure I see the following:

Error Details:

HTTP Error 403.14 - Forbidden
You do not have permission to view this directory or page.
The Web server is configured to not list the contents of this directory.

Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server. If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.

Troubleshooting Conducted:

  • Verification of Project Files: Confirmed the existence and integrity of App.razor within the untouched default project, which from my understanding is the equivalent of an Index or Host HTML file.
  • Kudu Check: Accessed the Azure Kudu console to verify that web.config appropriately references the nested "wwwroot" directory, everything seems in order but I'm not sure I have a complete picture of the context for how my directories should appear laid out.

Insight Needed:

Given that the template is unmodified and the deployment settings were set as default, I'm puzzled by where this error stems from. It runs fine on the localhost, so I'm guessing something might be incorrectly configured to find or recognize how to start the web app when deployed on an actual server, but I haven't been able to find anything immediately apparent in the .NET documentation.

Questions:

  • Could there be an overlooked setting in Azure or Visual Studio that's crucial for serving the default page of a Blazor project in an App Service environment?
  • Why is the "wwwroot" nested in a directory of the same name?
  • How does the interactive auto interact with setting up an App Service?
  • What context am I missing as a novice to this process?

Any insights or experiences shared would be greatly appreciated, thanks!

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,584 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,807 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 65,576 Reputation points
    2024-08-24T22:53:17.5066667+00:00

    when you set -int auto, this a Blazor project that is an asp.net core server blazor app for pre-render, that renders html that loads a client blazor app (WASM). (unlike a client blazor app which is basically a static site, with maybe an api)

    when you deploy to azure, the app service must configured for asp.net core and the .net version selected.

    https://zcusa.951200.xyz/en-us/aspnet/core/host-and-deploy/azure-apps/?view=aspnetcore-8.0&tabs=visual-studio

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.