dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
21.01k stars 4.91k forks source link

Cannot connect to Blazor website in unmodified example app #8293

Closed Grix closed 1 year ago

Grix commented 1 year ago

Problem encountered on https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/run Operating System: windows

I am following the Blazor Tutorial - "Build your first Blazor app", but I am having trouble getting it to work. I have created the project based on the example app as described in the tutorial. I have not changed anything. Now it comes time to run the app, but the web browser that pops up just says that it is unable to connect to localhost:7110. The server app in the console window also exits, with the following output:

` info: Microsoft.Hosting.Lifetime[14] Now listening on: https://localhost:7110 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5188 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: C:\BiobaseServer\BiobaseServer\

C:\BiobaseServer\BiobaseServer\bin\Debug\net6.0\BiobaseServer.exe (process 36648) exited with code -1. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . `

I don't know how to begin debugging this.

Grix commented 1 year ago

Update: This started working after a simple computer reboot. So while I no longer have the problem, I think the issue should still stay up because it is clearly a bug and can be confusing to new users that, as far as I remember, get no warning that they need to reboot the computer for ASP.NET to work.

krwq commented 1 year ago

@Grix note that while we'd like to address this issue we need something to reproduce it. Do you possibly have any information what did you change to get the error to go away? Can you try changing settings back and seeing what causes repro to happen again?

Without extra info it seems really hard to guess where issue might be...

Presumably repro is app from: https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/run - it would be really helpful if you could zip your app and attach here (or something where we could copy&paste quickly).

Also if you could share if that was the first time you were running dotnet and what other conditions changed that this stopped reproing

Grix commented 1 year ago

Sorry, I am unable to reproduce it any more. I did not change any settings or code, it simply started to work after a reboot. But some more information:

I had Visual Studio 2022 with .NET for desktop development already installed. I then used the VS Installer to add the "ASP.NET and web development" component. I did not reboot the computer after this, because as mentioned I don't remember it asking me to. I then created the example projects and the issue started. I can mention that I also tried other ASP.NET example projects, such as the empty one that only contains a hello world page, and this had the same problem. So I think it was something fundamental about the ASP.NET installation that required a reboot, not just that specific example project.

Other things I could mention is that I also have Visual Studio 2017 installed, as well as previously Visual Studio 2019, but the latter I uninstalled recently. I think at one point I had some older version of ASP.NET / Blazor installed on one of these previous VS and .NET installations, but that was quite some while ago so I don't remember what or when. So maybe there was some older components that was overwritten or referenced incorrectly until the reboot.

I have attached one of the projects as a zip, but I fear it won't be of any help since it's basically just the example project without any modifications, and as said, it works fine now. testapp.zip

krwq commented 1 year ago

IIRC VS Installer always requires restart. I think this issues is currently not actionable as is. Above is very useful info but we will likely need more reports to learn some more to figure out what's going on to determine if that is something we should address or not. While we'd like to investigate every report it would be impractical so we need to prioritize issues which have most user impact and don't have workaround. Given we're not sure yet what was the cause and it's currently not reproing anymore I'll suggest that we wait and see if anyone else hits this.

github-actions[bot] commented 1 year ago

This issue is stale because there has been no response to a request for more information for 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because there was no response to a request for more information for 10 days.

sbaum2s commented 1 month ago

IIRC VS Installer always requires restart. I think this issues is currently not actionable as is. Above is very useful info but we will likely need more reports to learn some more to figure out what's going on to determine if that is something we should address or not. While we'd like to investigate every report it would be impractical so we need to prioritize issues which have most user impact and don't have workaround. Given we're not sure yet what was the cause and it's currently not reproing anymore I'll suggest that we wait and see if anyone else hits this.

At the first start of the app it asks to add 2 fingerprints. After accepting that the "connection refused" error occurs in the browser. I restarted my computer and the problem is gone. I cannot tell you how to reproduce, since i did not pay much attention to these dialog boxes and where to search for these fingerprints so i could remove them and reproduce it.