Blazor Webassembly API Call Children could not be evaluated

Viewed 1606

I'm trying to call an existing rest API I have with my new Blazor Webassembly app, however when I make the call I always get the error Children could not be evaluated. The API hits the breakpoint and when I step through it returns the data successfully which I can also see if I call it in postman, however the Blazor call fails. I thought perhaps it was an issue with mismatching classes, however the class structure for TeamModel is identical as it is now a shared resource. I'm new with Blazor and I'm sure I'm missing something but could do with some direction or help.

private async Task FetchTeamData()
{
        try
        {
            List<TeamModel> teams;
            teams = await Http.GetFromJsonAsync<List<TeamModel>>("http://localhost:50663/api/team");
        }
        catch (Exception ex)
        {
            //Always blowing up with Children could not be evaluated here.
        }
}
[HttpGet]
public IActionResult GetAllTeams()
{
    List<TeamModel> teams = _teamRepository.GetAllTeams();

    return Ok(teams);
}

Edit: Well I've narrowed it down to being something wrong with the way the project is reading that API. I can call other hosted APIs fine. I'm not sure if its because its localhost or some other issue, but none of the localhost API methods will call properly I always get the same response from it.

1 Answers
Related