Skip to content

Blazor Tutorial Project attempts to use reserved port #16

Open

Description

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

I was getting the following error when running dotnet watch run:

Unable to bind to http://localhost:5000 on the IPv4 loopback interface: 'An attempt was made to access a socket in a way forbidden by its access permissions.'.

I found this SO reply: https://superuser.com/a/1504618

Running the listed command (netsh interface ipv4 show excludedportrange protocol=tcp) yielded several ranges which happened to overlap with port 5000. Changing the port in launchSettings.json allowed the watch command to run as expected.

The specific ranges seems to be different for every system that runs that command.

If there a way to free up these ports locally so that the tutorial can be run without modification? Alternatively, could the tutorial be changed to use a port that is not going to be reserved by Windows?

Some additional important, but less relevant questions:
Are there port ranges that are guaranteed NOT to be reserved at random by Windows?
Is the set of reserved port ranges meant to differ between systems? If so, why, and how does it pick the ranges?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-tutorialsIssues related to getting started tutorialsarea-websiteIssues related to the website in generaltutorial-blazorBlazor tutorial issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions