NET8 Blazor completed different website rendering

Enrico Rossini 186 Reputation points
2023-12-11T16:23:26.95+00:00

I'm still having issues with Blazor project and NET8. I'm creating a simple website that has a server project, a client project, and a few Blazor components. The component is an ImageSelect that requires adding some JavaScript in the App.razor. I updated the component to NET8 too.

The render of the website locally is quite what I like to see and there are no errors in the developer tools.

enter image description here

enter image description here

When I deploy the website and browse it, I get completely different results. Starting with Edge on MacOS or Windows.

Here is a screenshot of the web application on Microsoft Edge on MacOS (the same on Windows).

enter image description here

When I inspect the developer tools, I can see that all the CSS and JavaScript embedded in the components, are not found.

Failed to load resource: the server responded with a status of 403 () /_content/PSC.Blazor.Template.Newzin/js/lib/pace.js:1

enter image description here

Using Safari, the result is more strange. This is the screenshot I get when I open the website

There was an unhandled exception on the current request. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json'

enter image description here

This surprises me because in the Program.cs of the main project, the application has to read the appconfig.json related to the environment and when I deploy, the environment is Release. Then in the developer tools, I get those errors

enter image description here

I can't understand where the problem is and how I can fix it. I have created a GitHub repository with the Blazor solution but it doesn't have the dependencies because this is a quite big project. If you have to have a look at the Blazor, here you have the source code for a few days.

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,499 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,415 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,641 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,491 Reputation points
    2023-12-11T17:34:49.1266667+00:00

    the error 403 means access is forbidden. as the errors are for static files, that means the static file handler does not have access. you don't specify the hosting, but check the deployment and debug by fetching one file in the browser.

    0 comments No comments