My Godaddy remote hosted web API http://impexmail.co/api/Departments/Getdepartments responds to get and post requests from Postman and HTML with jQuery but not responding to Blazor WASM. With the same blazor WASM methods I can reach and get to for example https://jsonplaceholder.typicode.com/todos.. Any suggestions appreciated.
2 Answers
You making a call to a HTTP resource from HTTPS. This is blocked by Blazor. Docs are here.
I would upgrade your api to be https. Alternately you could run your app in http. You could override the policy's but I think you have a cors problem then.
1 Comment
adnan
Thank you. It worked after I installed nuget cors package and corrected enable cors in web api controllers, web api config. I also had to deselect https in blazor wasm.
I too think you have a CORS issue as mentioned by Brian Parker. You need to enable CORS on your Web API and re publish it to your shared hosting account. Check out Microsoft documentation below for enabling it in your project.
https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-3.1