locked
how to find the error in blazor wabassembly app(very difficult to find the error) RRS feed

  • Question

  • User-91993069 posted

    difficulty to find the error in webassembly(client side) blazor

    I am calling server side (blazor server app) webapi in client side((blazor webassembly app))

    first I create a blazor server app project and then use built in webapi framework for crud operation

    then I create a blazor webassembly project and then add this below razor page inside pages folder

    @page "/DisplayEmployeeData"
    @using CrudBlazorServerApp.Data
    @using System.Net.Http
    @inject HttpClient Http
    
    <h3>DisplayEmployeeData</h3>
    
    @if (empList == null)
    {
        <p><em>Loading...</em></p>
    }
    else
    {
        <table class='table'>
            <thead>
                <tr>
                    <th>empid</th>
                    <th>username</th>
                    <th>empaddress</th>
                    <th>password</th>
                    <th>country</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var emp in empList)
                {
                <tr>
                    <td>@emp.empid</td>
                    <td>@emp.username</td>
                    <td>@emp.empaddress</td>
                    <td>@emp.password</td>
                    <td>@emp.country</td>
    
                </tr>
                }
            </tbody>
        </table>
    }
    
    @code {
        Emp[] empList;
        protected override async Task OnInitializedAsync() =>
            empList = await Http.GetJsonAsync<Emp[]>("api/emps/"); //**here I put the debugger but emplist give the null**
    }

    In below image which error?I am not able to see any error?

    when I calling the webapi in client side then very very difficulty to find the error

    what type error?

    my webapi path is wrong?

    see my console log very very difficulty to find the error?

    Saturday, August 29, 2020 7:17 AM

All replies

  • User-91993069 posted

    isssue is solved

    Saturday, August 29, 2020 10:55 AM