0

I set up Thrift to build two entities and a corresponding service. I genereated the code for C#, created a small console application for the server and another one for a test client. I ran both on my local machine and it worked like a charm. But when deploying the server on my Azure VM running Windows Server 2012, with an endpoint created on port 9090 for TCP, my client can't connect. There's a timeout.

Similar questions on SO: This one is about a php library specific problem and this one is about two linux machines. The latter one is close to my question, but I can imagine my problem is Windows or Azure VM specific.

I'm using Thrift 0.9.0.0 from NuGet. I tried SimpleServer and ThreadPoolServer. This is what I'm doing on the server:

Thrift.Server.TServer server = new Thrift.Server.TThreadPoolServer(new TodoThriftService.Processor(new TodoThriftServiceHandler()), new TServerSocket(9090));

This is what I'm doing on the client:

TodoThriftService.Client client = new TodoThriftService.Client(new TBinaryProtocol(new TSocket("my.host.com", 9090)));

I also tried the server IP address instead of its host name, but it didn't work either.

netstat -an output is:

TCP    0.0.0.0:9090           0.0.0.0:0              LISTENING

Output from telnet from client (telnet my.host.com 9090):

Verbindungsaufbau zu my.host.com...Es konnte keine Verbindung mit dem Host hergestellt werden, auf Port 9090: Verbindungsfehler

Which is German for "connection error".

When I visit http://canyouseeme.org/ on the server and check port 9090 the output is:

Error: I could not see your service on 123.34.567.890 on port (9090). Reason: Connection timed out

When I sniff packets with Wireshark on the server the output is:

1   0.000000000 12.3.456.78 12.34.567.89    TCP 66  53566 > websm [SYN] Seq=0 Win=8192 Len=0 MSS=1452 WS=256 SACK_PERM=1

And two retransmissions.

Note: The destination IP shown in Wireshark differs from the IP that canyouseeme.org determined.

Also note: Both connection attempts from my test client as well as from canyouseeme.org are shown in Wireshark.

Is my server console application doing anything wrong? It works fine on my local machine.

Community
  • 1
  • 1
phlow
  • 122
  • 5
  • 12
  • The most used sentence when someone reports a problem: "*Yeah, but it works fine on my local machine!*". I wish, I would have gotten a $ every time I heard it. => ยง1 You development environment is highly unlikely to match the desired prod environment. You will have less rights, less permissions and there may be less things allowed to do because the environment may be locked down and/or better firewalled. The only recommendation is to find out, why the connection is blocked. I think canyouseeme is probably right about it. โ€“ JensG Oct 27 '13 at 12:10
  • Well, of course the environments differ, but that's not the point (neither did I claim anything else). When I (and others) point out that something works on their local machine, then it's not just useful but necessary information for people willing to help, so they know what works and what doesn't and to narrow down the possible sources of the problem. Isn't it? Or is it just the bold text part that bothers you? -> Changed it. โ€“ phlow Oct 27 '13 at 13:11

1 Answers1

1

Because netstat reports that your server is listening on 9090, and because tcpdump reports that SYN packets are arriving to 9090, something else must be blocking the client.

My suspicion in this case would be some sort of local firewall (because the packets did arrive, but the OS should have answered with a SYN packet and you didn't see that). Check Windows Firewall to make sure port 9090 is open.

Andrew
  • 186
  • 1
  • 3
  • Thanks Andrew, that was it! I added the compiled MyThriftService.exe to the allowed Apps in Windows Firewall and it works now. The settings can be found here: Control Panel\System and Security\Windows Firewall\Allowed apps, then "Allow another app" -> "Browse" -> "Add". I was fooled by the Azure "endpoint" - I thought that it would handle everything, because it worked with the MS SQL, Remote Desktop and Visual Studio Web Deploy ports. โ€“ phlow Oct 28 '13 at 17:41