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;








1















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);












share|improve this question
























  • 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

















1















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);












share|improve this question
























  • 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













1












1








1








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);












share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 4:52









mklement0

142k23257294




142k23257294










asked Mar 22 at 21:28









johnildergleidissonjohnildergleidisson

1,17432144




1,17432144












  • 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

















  • 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
















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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현