❔ ASP.NET Core default template app fails with Electron.NET - I don't understand the ports
I'm making my first excursion in C# apps using ASP.NET Core and Electron.NET. I have a net6 project.
I have created a basic NET6 ASP.NET Core app from the templates, and followed Electron.NET instructions to add support for it. I have changed nothing else about the example app.
The example comes with a
weatherforecast/
URL which calls a controller to return some weather forecast info. However, the app says:
Error occurred while trying to proxy: localhost:44408/weatherforecast
I seem to have the following various bits of info:
- launchSettings.json iisSettings
: applicationUrl localhost:15555
and sslPort 44342
- launchSettings.json ProjectNameHere
profile: applicationUrl localhost:7092;localhost:5140
- app terminal says Use Electron Port: 8000
- app terminal says ASP.NET Core Watch Port: 8001
- app terminal says Now listening on: http://localhost:8001
- app terminal says stdout: warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect.
- .env.development says PORT=44408
- spa.proxy.json
says PORT=44408
- csproj file says <SpaProxyServerUrl>https://localhost:44408</SpaProxyServerUrl>
I am launching the app via electronize start /watch
.
So... what the heck are these 50000 different ports in my application? I need 1 port for my JavaScript Electron output, and 1 port for the .NET API server. What are those other ones? How can I fix the issue and remove this superfluous information?
Let me know if you need additional info.4 Replies
Interestingly, I get the
/weatherforecast
output if I navigate to http://localhost:8001/weatherforecast
.If, instead of manually running
electronize start /watch
, I try to run the "Electron.NET App" launch profile, I get this and nothing happens...The ports function correctly if I start the app via the
ProjectNameHere
profile, however then it's not an Electron.NET app, the Electron window doesn't appear. It just starts the ASP.NET server in the browser.Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.