
I'm trying to call RestAPI data, using httpclient library in nuget.


It works fine in the browser, but if I build it with electron.net in the same environment and click it,
there is no response.
github code link is below
https://github.com/graylobo/BlazorTron
Can I fix this issue? thanks in advance
Your ElectronNET port does not match the port of the RestAPI call.
Add following line to your Program.cs:
webBuilder.UseStartup
webBuilder.UseUrls("http://*:8001"); //e.g. 8001
RestAPI.razor:
Students = await http.GetJsonAsync>("http://localhost:8001/api/students");

Thank you. It works well thanks to your advice.
However, How can i get bact to the main page (_Host.cshtml) if i in new page? (e.g. json link page)


I try to new MenuItem
{
Label = "Home",
Accelerator = "CmdOrCtrl+H",Role = MenuRole.undo
}``
but it doesn't work.
And if I want to debugging electron.net, is this answer is the best way to do it yet?
https://github.com/ElectronNET/Electron.NET/issues/298
Is it normal for a breakpoint not to be recognized at electron.net runtime even if a breakpoint is specified?
Try this but I don't know if this is best practice:
new MenuItem { Label = "Home", Click = () => Electron.WindowManager.BrowserWindows.First().LoadURL("http://localhost:8001/")
The safest way would be:
new MenuItem { Label = "Home", Click = () => Electron.WindowManager.BrowserWindows.First().LoadURL($"http://localhost:{BridgeSettings.WebPort}/")
Did we solve your problem?
Yes, it works perfect. Thanks a bunch!
Most helpful comment
The safest way would be:
new MenuItem { Label = "Home", Click = () => Electron.WindowManager.BrowserWindows.First().LoadURL($"http://localhost:{BridgeSettings.WebPort}/")Did we solve your problem?