mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Not calling RestAPI #492
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @graylobo on GitHub (May 17, 2020).
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
@konstantingross commented on GitHub (May 17, 2020):
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<List>("http://localhost:8001/api/students");
@graylobo commented on GitHub (May 18, 2020):
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?
@konstantingross commented on GitHub (May 18, 2020):
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/")@GregorBiswanger commented on GitHub (May 18, 2020):
The safest way would be:
new MenuItem { Label = "Home", Click = () => Electron.WindowManager.BrowserWindows.First().LoadURL($"http://localhost:{BridgeSettings.WebPort}/")Did we solve your problem?
@graylobo commented on GitHub (May 19, 2020):
Yes, it works perfect. Thanks a bunch!