tag:help.appveyor.com,2012-11-13:/discussions/questions/1556-allow-listen-ports-and-new-connections-to-localhostAppVeyor: Discussion 2018-08-25T02:25:55Ztag:help.appveyor.com,2012-11-13:Comment/375762952015-08-05T19:24:43Z2015-08-05T19:24:43ZAllow listen ports and new connections to localhost<div><p>I am seeing consistent failures in the unit test suite for the
EventMachine Ruby gem where it cannot connect to local ports. The
unit test basically creates local dummy services and then connects
to them to make sure the connections succeed.</p>
<p>I'm also not able to do DNS resolution from within EventMachine,
which may be related.<br>
<a href="https://ci.appveyor.com/project/sodabrew/eventmachine/build/44/job/pukgfcokrofgof2r">
https://ci.appveyor.com/project/sodabrew/eventmachine/build/44/job/...</a></p>
<p>I tried following steps at <a href="https://support.microsoft.com/en-us/kb/947709">https://support.microsoft.com/en-us/kb/947709</a>
as suggested by <a href="http://help.appveyor.com/discussions/problems/596-conection-refused-at-1270018088">
http://help.appveyor.com/discussions/problems/596-conection-refused...</a>
but this didn't help.</p>
<p>The appveyor.yml command I ran was:<br></p>
<pre>
<code>install:
- netsh advfirewall firewall add rule name="Ruby" dir=in action=allow program="C:\Ruby%ruby_version%\bin\ruby.exe" enable=yes remoteip=127.0.0.1/24,LocalSubnet</code>
</pre></div>sodabrewtag:help.appveyor.com,2012-11-13:Comment/375762952015-08-05T19:53:04Z2015-08-05T19:53:04ZAllow listen ports and new connections to localhost<div><p>Why do you think it's firewall problem (especially, when it's
loopback address)?</p>
<p>Try using <code>netstat -ab</code> command to see what process
is listening and on what port.</p>
<p>In general, listening on 127.0.0.1 and requesting it locally
works like in this example with local IIS: <a href="https://ci.appveyor.com/project/FeodorFitsner/simple-console/build/1.0.726">
https://ci.appveyor.com/project/FeodorFitsner/simple-console/build/...</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375762952015-08-07T07:14:46Z2015-08-07T07:14:46ZAllow listen ports and new connections to localhost<div><p>I was suspecting the firewall settings because I cannot
reproduce these failures on my local Windows installation, neither
Windows 8.1 Enterprise nor Windows 10. I was prompted to allow/deny
Ruby to listen on the network interfaces, which I allowed, so I
wondered if I needed to do the same thing for AppVeyor's
instances.</p></div>sodabrewtag:help.appveyor.com,2012-11-13:Comment/375762952015-08-07T22:35:38Z2015-08-07T22:35:38ZAllow listen ports and new connections to localhost<div><p>So, it's kind of passing that window asking for permission to
use network?<br>
OK, can you see that window if logged to build worker via RDP?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375762952017-11-29T21:30:07Z2017-11-29T21:30:10ZAllow listen ports and new connections to localhost<div><p>Hello!</p>
<p>I have a similar problem. I'm working on <a href="https://github.com/otcshare/iotivity-node">https://github.com/otcshare/iotivity-node</a>, and I ran <a href="https://ci.appveyor.com/project/gabrielschulhof/iotivity-node-roxkw/build/1.0.696/job/4b9mt02iptt0k0on#L848">https://ci.appveyor.com/project/gabrielschulhof/iotivity-node-roxkw...</a> where, as you can see, all the tests pass except the one attempting to use DTLS. This test passes locally in my Windows 10 VirtualBox VM. However, the first time I ran it, it popped a message asking whether I want to allow connections of the kind. I quickly answered before the test would fail, so I didn't really have time to look at the contents of the dialog.</p>
<p>Is there a way to turn off the firewall using the appveyor.yml file?</p>
<p>Alternatively, how do I log into the build worker via RDP, as you suggest above?</p>
<p>Thanks in advance for your help and advice!</p></div>gabriel.schulhoftag:help.appveyor.com,2012-11-13:Comment/375762952017-11-29T22:13:59Z2017-11-29T22:13:59ZAllow listen ports and new connections to localhost<div><p>I've tried adding</p>
<ul>
<li>ps: Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False</li>
</ul>
<p>to the install step, but it hasn't helped.</p></div>gabriel.schulhoftag:help.appveyor.com,2012-11-13:Comment/375762952017-11-29T22:39:15Z2017-11-29T22:39:15ZAllow listen ports and new connections to localhost<div><p><strong>@gabriel</strong> as I understand you are starting server before trying to connect to it <a href="https://ci.appveyor.com/project/gabrielschulhof/iotivity-node-roxkw/build/1.0.696/job/4b9mt02iptt0k0on#L856">here</a> and shut it down <a href="https://ci.appveyor.com/project/gabrielschulhof/iotivity-node-roxkw/build/1.0.696/job/4b9mt02iptt0k0on#L916">after test</a>.</p>
<p>What I would recommend is to connect with <strong>blocking</strong> RDP on build finish (<a href="https://www.appveyor.com/docs/how-to/rdp-to-build-worker/">doc</a>) and do the following:</p>
<ul>
<li>
<p>try run test manually and see if that dialog pops up and if it works with RDP. Make screenshot of that dialog :)</p>
</li>
<li>
<p>if dialog does not pops up and error reproduces on RDP, try the following</p>
<ul>
<li>modify test to do not stop server</li>
<li>run <code>netstat -na -p UDP</code> before and after test. Thus we will see if server really started listening and on what port.</li>
</ul>
</li>
</ul>
<p>Please let us know what you found.</p>
<p>Thanks!<br>
Ilya.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/375762952017-12-03T23:14:16Z2017-12-03T23:14:17ZAllow listen ports and new connections to localhost<div><p>The dialog did not pop up. I ran <code>netstat -apn</code> before, during, and after the test, and I got the following results:</p>
<pre>
<code>C:\Users\appveyor>netstat -apn UDP
Active Connections
Proto Local Address Foreign Address State
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3389 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 192.168.0.203:137 *:*
UDP 192.168.0.203:138 *:*
C:\Users\appveyor>netstat -apn UDP
Active Connections
Proto Local Address Foreign Address State
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3389 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:51928 *:*
UDP 0.0.0.0:51929 *:*
UDP 0.0.0.0:51932 *:*
UDP 0.0.0.0:51933 *:*
UDP 192.168.0.203:137 *:*
UDP 192.168.0.203:138 *:*
C:\Users\appveyor>netstat -apn UDP
Active Connections
Proto Local Address Foreign Address State
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3389 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:51928 *:*
UDP 0.0.0.0:51929 *:*
UDP 0.0.0.0:51932 *:*
UDP 0.0.0.0:51933 *:*
UDP 192.168.0.203:137 *:*
UDP 192.168.0.203:138 *:*
C:\Users\appveyor>netstat -apn UDP
Active Connections
Proto Local Address Foreign Address State
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3389 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5683 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:5684 *:*
UDP 0.0.0.0:51928 *:*
UDP 0.0.0.0:51929 *:*
UDP 0.0.0.0:51932 *:*
UDP 0.0.0.0:51933 *:*
UDP 192.168.0.203:137 *:*
UDP 192.168.0.203:138 *:*
C:\Users\appveyor>netstat -apn UDP
Active Connections
Proto Local Address Foreign Address State
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3389 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 192.168.0.203:137 *:*
UDP 192.168.0.203:138 *:*
C:\Users\appveyor></code>
</pre>
<p>So, the server is indeed listening during the test, yet the client is unable to connect to it.</p>
<p>In fact, I ran just the server, and, indeed, more UDP ports are open when the server is running than there are when it is not.</p></div>gabriel.schulhoftag:help.appveyor.com,2012-11-13:Comment/375762952017-12-04T15:30:15Z2017-12-04T15:30:17ZAllow listen ports and new connections to localhost<div><p>I'm not sure if it makes a difference, but the server does not listen on pre-determined ports. It listens on different ports at different times.</p></div>gabriel.schulhoftag:help.appveyor.com,2012-11-13:Comment/375762952017-12-04T23:37:43Z2017-12-04T23:37:43ZAllow listen ports and new connections to localhost<div><p>Is client tying to connect to the port opened by server?</p>
<p>Also can you please run <code>Get-NetUDPEndpoint</code> instead of <code>netstat -apn UDP</code> because it will show also IPv6 information (I just realized that client is trying to open IPv6 endpoint).</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/375762952017-12-25T17:24:57Z2017-12-25T17:24:59ZAllow listen ports and new connections to localhost<div><p>I am having the same issue. I am binding to 0.0.0.0:12345, works fine on all dev machines, but yes, you do have to accept the firewall dialog.</p></div>Ovan Cronetag:help.appveyor.com,2012-11-13:Comment/375762952017-12-27T22:37:34Z2017-12-27T22:37:34ZAllow listen ports and new connections to localhost<div><p><strong>@ Ovan Crone</strong> can you provide a repro? Also if you add <a href="https://www.appveyor.com/docs/how-to/rdp-to-build-worker/">RDP</a>, do you see the same firewall dialog on the AppVeyor VM? You can add non-blocking RDP at the <code>init</code> stage and blocking RDP at <code>on_finish</code> stage.</p></div>Ilya Finkelshteyn