Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load URL: http://localhost:8001/ with error: ERR_CONNECTION_RESET #765

Closed
nazar322 opened this issue Apr 15, 2023 · 12 comments
Closed
Assignees
Labels

Comments

@nazar322
Copy link

  • Version: 23.6.1
  • .NET: 6
  • Node: v18.15.0

After updating Electron.NET to 23.6.1 I can't no longer start my app, I have this error all the time
Got disconnect! Reason: transport close (node:16976) electron: Failed to load URL: http://localhost:8001/ with error: ERR_CONNECTION_RESET (Use electron --trace-warnings ... to show where the warning was created)
how can I add --trace-warnings to electron?
This is how I launch the app electronize start /args "--remote-debugging-port=9222" /dotnet-configuration "Release_Windows"
I have tried running it like this electronize start /args "--remote-debugging-port=9222 --trace-warnings" /dotnet-configuration "Release_Windows" but it did not change anything in the output

@nazar322 nazar322 added the bug label Apr 15, 2023
@nazar322
Copy link
Author

Not a bug looks like but I have asked at Gitter and no one replied.

@nazar322
Copy link
Author

image

@nazar322
Copy link
Author

In TCPView I see that port 8001 has been created and connected by electron.exe but a few seconds later the port gets closed and Got disconnected is shown.

@GregorBiswanger
Copy link
Member

Do you have the Electron.NET CLI in the same version 23.6.1 also?

Delete the obj/host folder please and try again.

@GregorBiswanger GregorBiswanger self-assigned this Apr 15, 2023
@nazar322
Copy link
Author

I have the CLI installed
image

Deleting obj/host did not help

@GregorBiswanger
Copy link
Member

You can reproduce the issue in a MRE that you can give us in form of a GitHub repository (such that we only need to clone and open to see the issue appearing on our machines)

@nazar322
Copy link
Author

I'm on it...

@nazar322
Copy link
Author

I have stripped the project I am working on and that causing the problem
https://drive.google.com/file/d/1PpT-JREP-1Qp5ViJ6r568BDbIsD6df4e/view?usp=share_link

Video recording
https://drive.google.com/file/d/19wtVQj8AlSFF9rQLtjRG87e0XKNUp2NA/view?usp=share_link

You can see on the video that the splash screen (via electron.manifest.json) is shown, next it disappears but the main window is not shown + 8001 port been opened.
Ignore JIT debug pop-up, I have System.Diagnostics.Debugger.Launch(); in Main.

electronize start /args "--remote-debugging-port=9222" /dotnet-configuration "Release_Windows"
from the Frontend folder as shown in the video.

@GregorBiswanger
Copy link
Member

The first thing that strikes me is that Electron is having trouble accessing the default URL. If I want to start the frontend project alone in Visual Studio, I get error messages.

image

My tip: Remove the SPA Services and integrate Angular manually. You free yourself from this built-in dependency, which always leads to problems. You can find enough tutorials online on how to integrate Angular with ASP.NET Core WITHOUT SPA Services. As soon as the project can be run normally in the browser without electron, your example will work again with Electron.NET.

@nazar322
Copy link
Author

@GregorBiswanger I'll try it, thanks!

@GregorBiswanger
Copy link
Member

If you have made your changes and it still doesn't work, then you are very welcome to reopen the issue.

@nazar322
Copy link
Author

I found the problem place in my code. It was this line
Electron.App.On("activate", async () =>
on its execution the app just died somewhere within and there was CONNECTION_RESET.
As soon as I changed the line to Electron.App.On("activate", async _ => i.e. I added named parameter it started to pass execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants