How to fix a Errror Handling for Blazor Hybrid MAUI and WebApi

sblb 1,231 Reputation points
2024-10-05T17:29:37.3866667+00:00

Hi, I've reference an WebApi to my Blazor Hybrid App. The database that I used is SQLite

When I run the app "Windows machine" the response is Html

User's image

The WebApi run well!!I've checked with swagger the response is OK.

I suppose that the problem is localised in MauiProgram.cs

I've linked the webapi as below

User's image

Have you an idea how I can fix this problem?

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
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. sblb 1,231 Reputation points
    2024-10-06T09:18:47.41+00:00

    Here the response from adtpage, you can see that Content-Type is text/html so it should be application/json.

    User's image

    I tested the webapi in swagger to GET the data from adtpage Content-Type is application/json

    User's image

    Can anyone help me solve this problem?


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.