Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
HttpClient inject isn't working in Blazor 0.8 #1780
I have created a new blazor component and tried to call get data from json file.
And got this error:
What's wrong here?
This is working in Blazor 0.7, but not working in Blazor 0.8
It looks like your app is actually setup to use ASP.NET Core Razor Components instead of Blazor. Razor Components apps use the components.server.js script, but for Blazor you use components.webassemlby.js. Blazor Apps register a preconfigured
In a Razor Components app you can just create new HttpClient instances, or if you want, you can register HttpClient as a service yourself. See https://github.com/Suchiman/BlazorDualMode for an example of how to do this.
I hope this helps!