Blazor wasm hosted - cannot access api method on hosted domain?

Ian Coetzer 86 Reputation points
2021-05-10T18:13:34.67+00:00

Hi

When I create a blazor wasm hosted web application I can publish the project successfully.
then in the Server\bin\Release\net5.0\publish folder I can run the project server .exe and using https://localhost:5001 I can test the web application and access the default weather service page - which the client app uses to obtain sample records from the server api.

However, when I host the published server project on my hosting provider - I can access the client app but any service method calls to - for example the weather sample data results in a 404 error?

What must I configure / setup to allow my web application (blazor wasm hosted) to work on a deployed hosting provider?

dotnet.5.0.5.js:1 GET https://amoebaservices.co.za/WeatherForecast 404

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: net_http_message_not_success_statuscode, 404, Not Found
System.Net.Http.HttpRequestException: net_http_message_not_success_statuscode, 404, Not Found
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()

95318-project-test-open.png

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,577 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ian Coetzer 86 Reputation points
    2021-05-11T15:41:04.517+00:00

    Hi

    I deployed everything from the \bin\Release\net5.0\publish\ folder
    I even zipped the entire folder - copied that to the hosting server - and then unzipped it there to make sure no file is missing.

    0 comments No comments

  2. Ian Coetzer 86 Reputation points
    2021-05-30T13:06:05.09+00:00

    Hi

    I managed to get the simple Blazor website up and running successfully.
    It turned out to be that the IIS application pool had not been granted adequate permissions to the folder which hosts the website.

    I actually had to change to a different services provider - who managed to diagnose the issue and after granting the required permissions the web application worked.

    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.