Cannot open port 2000 on 127.0.0.1 adapter - how to find the reason?How can you find out which process is listening on a port on Windows?problem in socket connectionWindows PGM socket access error with non-admin accountC# listening 80 portHow do I fix the error “Only one usage of each socket address (protocol/network address/port) is normally permitted”?Why do I get C# raw socket error?Calling https web service form another web serviceError “An attempt was made to access a socket in a way forbidden by its access permissions”Running TCPListener from a Windows ServiceRead from specific port
Upside-Down Pyramid Addition...REVERSED!
Is this homebrew life-stealing melee cantrip unbalanced?
How can I support myself financially as a 17 year old with a loan?
Junior developer struggles: how to communicate with management?
Why was the battle set up *outside* Winterfell?
What was the state of the German rail system in 1944?
Enumerate Derangements
Reconstruct a matrix from its traces
If a prion is a protein, why is it not disassembled by the digestive system?
Point of the the Dothraki's attack in GoT S8E3?
Does a wine bottle stopper require tevillah?
What happens if I start too many background jobs?
60s (or earlier) SF short story with FTL Travel using electron psychology aka addiclenendar technology
Accidentally deleted the "/usr/share" folder
Missed the connecting flight, separate tickets on same airline - who is responsible?
Can I get a paladin's steed by True Polymorphing into a monster that can cast Find Steed?
Is it cheaper to drop cargo than to land it?
Why wasn't the Night King naked in S08E03?
Type-check an expression
Why is `abs()` implemented differently?
Identifying a transmission to myself
Catholic vs Protestant Support for Nazism in Germany
If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?
Do I have to make someone coauthor if he/she solves a problem in StackExchange, asked by myself, which is later used in my paper?
Cannot open port 2000 on 127.0.0.1 adapter - how to find the reason?
How can you find out which process is listening on a port on Windows?problem in socket connectionWindows PGM socket access error with non-admin accountC# listening 80 portHow do I fix the error “Only one usage of each socket address (protocol/network address/port) is normally permitted”?Why do I get C# raw socket error?Calling https web service form another web serviceError “An attempt was made to access a socket in a way forbidden by its access permissions”Running TCPListener from a Windows ServiceRead from specific port
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
For months I haven't run a .NET application we develop, which worked fine last time around. In the meantime, I've updated my computer to Windows 10 Pro 1809 (as well as at home).
Today I tried running it, and it wasn't behaving properly. I debugged it and narrowed it down to an exception after the code attempts to start a TCP server on a configurable port, which is by default 2000
.
The exception is the following:
System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions
It is thrown when this code is executed:
listener = new TcpListener("127.0.0.1", 2000);
listener.Start();
I did the normal diagnostic steps, to no avail:
- Is anything already listening on that port
- Disable firewall
- Re-enable the firewall then delete rules surrounding the application and the port in question
- Enable firewall logging to see if there's any evidence of it rejecting
So I quickly test the same in a PowerShell script:
$port = 2000
$listener = new-object System.Net.Sockets.TcpListener ("127.0.0.1", $port)
try
$listener.start()
Write-Output "Successfully opened port $port"
catch
Write-Error $_
finally
$listener.Stop()
And I get pretty much the same exception:Exception calling "Start" with "0" argument(s): "An attempt was made to access a socket in a
way forbidden by its access permissions"
Next I decide to change the port to 3000
and it works fine.
Next I adapt the script to loop between ports from 1
to 2500
and get a bunch of failures, including ranges from 1657
to 2156
and 2179
to 2279
.
Where would one go next to find the root cause? What mechanism could Windows be using to reject the binding (?) attempt?
UPDATE
Tried this C# application and I get the same result:
namespace TcpBindTest
using System.Net;
using System.Net.Sockets;
class Program
static void Main(string[] args)
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint endpoint = new IPEndPoint(new IPAddress(new byte[]127, 0, 0, 1), 2000);
listener.Bind(endpoint);
listener.Listen(1);
c# windows powershell tcp tcplistener
add a comment |
For months I haven't run a .NET application we develop, which worked fine last time around. In the meantime, I've updated my computer to Windows 10 Pro 1809 (as well as at home).
Today I tried running it, and it wasn't behaving properly. I debugged it and narrowed it down to an exception after the code attempts to start a TCP server on a configurable port, which is by default 2000
.
The exception is the following:
System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions
It is thrown when this code is executed:
listener = new TcpListener("127.0.0.1", 2000);
listener.Start();
I did the normal diagnostic steps, to no avail:
- Is anything already listening on that port
- Disable firewall
- Re-enable the firewall then delete rules surrounding the application and the port in question
- Enable firewall logging to see if there's any evidence of it rejecting
So I quickly test the same in a PowerShell script:
$port = 2000
$listener = new-object System.Net.Sockets.TcpListener ("127.0.0.1", $port)
try
$listener.start()
Write-Output "Successfully opened port $port"
catch
Write-Error $_
finally
$listener.Stop()
And I get pretty much the same exception:Exception calling "Start" with "0" argument(s): "An attempt was made to access a socket in a
way forbidden by its access permissions"
Next I decide to change the port to 3000
and it works fine.
Next I adapt the script to loop between ports from 1
to 2500
and get a bunch of failures, including ranges from 1657
to 2156
and 2179
to 2279
.
Where would one go next to find the root cause? What mechanism could Windows be using to reject the binding (?) attempt?
UPDATE
Tried this C# application and I get the same result:
namespace TcpBindTest
using System.Net;
using System.Net.Sockets;
class Program
static void Main(string[] args)
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint endpoint = new IPEndPoint(new IPAddress(new byte[]127, 0, 0, 1), 2000);
listener.Bind(endpoint);
listener.Listen(1);
c# windows powershell tcp tcplistener
Have you triednetstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.
– Zer0
Mar 22 at 21:36
@Zer0 yes I have triednetstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...
– johnildergleidisson
Mar 22 at 21:38
add a comment |
For months I haven't run a .NET application we develop, which worked fine last time around. In the meantime, I've updated my computer to Windows 10 Pro 1809 (as well as at home).
Today I tried running it, and it wasn't behaving properly. I debugged it and narrowed it down to an exception after the code attempts to start a TCP server on a configurable port, which is by default 2000
.
The exception is the following:
System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions
It is thrown when this code is executed:
listener = new TcpListener("127.0.0.1", 2000);
listener.Start();
I did the normal diagnostic steps, to no avail:
- Is anything already listening on that port
- Disable firewall
- Re-enable the firewall then delete rules surrounding the application and the port in question
- Enable firewall logging to see if there's any evidence of it rejecting
So I quickly test the same in a PowerShell script:
$port = 2000
$listener = new-object System.Net.Sockets.TcpListener ("127.0.0.1", $port)
try
$listener.start()
Write-Output "Successfully opened port $port"
catch
Write-Error $_
finally
$listener.Stop()
And I get pretty much the same exception:Exception calling "Start" with "0" argument(s): "An attempt was made to access a socket in a
way forbidden by its access permissions"
Next I decide to change the port to 3000
and it works fine.
Next I adapt the script to loop between ports from 1
to 2500
and get a bunch of failures, including ranges from 1657
to 2156
and 2179
to 2279
.
Where would one go next to find the root cause? What mechanism could Windows be using to reject the binding (?) attempt?
UPDATE
Tried this C# application and I get the same result:
namespace TcpBindTest
using System.Net;
using System.Net.Sockets;
class Program
static void Main(string[] args)
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint endpoint = new IPEndPoint(new IPAddress(new byte[]127, 0, 0, 1), 2000);
listener.Bind(endpoint);
listener.Listen(1);
c# windows powershell tcp tcplistener
For months I haven't run a .NET application we develop, which worked fine last time around. In the meantime, I've updated my computer to Windows 10 Pro 1809 (as well as at home).
Today I tried running it, and it wasn't behaving properly. I debugged it and narrowed it down to an exception after the code attempts to start a TCP server on a configurable port, which is by default 2000
.
The exception is the following:
System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions
It is thrown when this code is executed:
listener = new TcpListener("127.0.0.1", 2000);
listener.Start();
I did the normal diagnostic steps, to no avail:
- Is anything already listening on that port
- Disable firewall
- Re-enable the firewall then delete rules surrounding the application and the port in question
- Enable firewall logging to see if there's any evidence of it rejecting
So I quickly test the same in a PowerShell script:
$port = 2000
$listener = new-object System.Net.Sockets.TcpListener ("127.0.0.1", $port)
try
$listener.start()
Write-Output "Successfully opened port $port"
catch
Write-Error $_
finally
$listener.Stop()
And I get pretty much the same exception:Exception calling "Start" with "0" argument(s): "An attempt was made to access a socket in a
way forbidden by its access permissions"
Next I decide to change the port to 3000
and it works fine.
Next I adapt the script to loop between ports from 1
to 2500
and get a bunch of failures, including ranges from 1657
to 2156
and 2179
to 2279
.
Where would one go next to find the root cause? What mechanism could Windows be using to reject the binding (?) attempt?
UPDATE
Tried this C# application and I get the same result:
namespace TcpBindTest
using System.Net;
using System.Net.Sockets;
class Program
static void Main(string[] args)
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint endpoint = new IPEndPoint(new IPAddress(new byte[]127, 0, 0, 1), 2000);
listener.Bind(endpoint);
listener.Listen(1);
c# windows powershell tcp tcplistener
c# windows powershell tcp tcplistener
edited Mar 23 at 4:52
mklement0
142k23257294
142k23257294
asked Mar 22 at 21:28
johnildergleidissonjohnildergleidisson
1,17432144
1,17432144
Have you triednetstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.
– Zer0
Mar 22 at 21:36
@Zer0 yes I have triednetstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...
– johnildergleidisson
Mar 22 at 21:38
add a comment |
Have you triednetstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.
– Zer0
Mar 22 at 21:36
@Zer0 yes I have triednetstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...
– johnildergleidisson
Mar 22 at 21:38
Have you tried
netstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.– Zer0
Mar 22 at 21:36
Have you tried
netstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.– Zer0
Mar 22 at 21:36
@Zer0 yes I have tried
netstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...– johnildergleidisson
Mar 22 at 21:38
@Zer0 yes I have tried
netstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...– johnildergleidisson
Mar 22 at 21:38
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308020%2fcannot-open-port-2000-on-127-0-0-1-adapter-how-to-find-the-reason%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308020%2fcannot-open-port-2000-on-127-0-0-1-adapter-how-to-find-the-reason%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried
netstat -ano
to see what's listening or try running your code as admin? Antivirus software can also block specific port ranges.– Zer0
Mar 22 at 21:36
@Zer0 yes I have tried
netstat
. My colleague is under the same network environment as me, and it all works on his computer (same antivirus, same group policies in the domain, etc)...– johnildergleidisson
Mar 22 at 21:38