Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omnisharp doesn't listen on localhost #180

Open
afiodorov opened this issue Feb 11, 2015 · 8 comments
Open

Omnisharp doesn't listen on localhost #180

afiodorov opened this issue Feb 11, 2015 · 8 comments

Comments

@afiodorov
Copy link

This looks like local misconfiguration, but I can't seem to force mono to listen on localhost instead of remote network:

Stop iptables so that they don't interfere:

sudo systemctl stop iptables.service

Start omnisharp:

/usr/bin/mono /home/tom/.vim/bundle/omnisharp-vim/server/OmniSharp/bin/Debug/OmniSharp.exe -p 2000 -s /home/tom/csharp/playground.sln -v Verbose

Check if I can connect to it:

telnet localhost 2000
Trying ::1...
Connection failed: Connection refused
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

See if port is open

lsof -i TCP| fgrep LISTEN | grep mono
mono      27675  tom    4u  IPv4 6274518      0t0  TCP BLAHBLAH.members.linode.com:cisco-sccp (LISTEN)

Try remote host:

telnet BLAHBLAH.members.linode.com 2000                                                        
Trying /*my remote ip here*/...
Connected to BLAHBLAH.members.linode.com.
Escape character is '^]'.
^]
@jtbm37
Copy link
Contributor

jtbm37 commented Apr 13, 2015

@nosami
Copy link
Contributor

nosami commented Apr 13, 2015

You have a localhost entry in /etc/hosts ?
On 13 Apr 2015 14:42, "jtbm37" notifications@github.com wrote:

I think it is listening on localhost.

https://github.com/OmniSharp/omnisharp-server/blob/master/OmniSharp/Program.cs#L127


Reply to this email directly or view it on GitHub
#180 (comment)
.

@nosami
Copy link
Contributor

nosami commented Apr 13, 2015

Oh... do you have an IPv4 entry for localhost?

@lishali12345
Copy link

The same problem, I use the OmniSharpSublime for ST3.
When I started the ST3, the OmniSharp Server start succeed, but it just LISTEN on my remote IP address, like 192.168.1.11, not on 127.0.0.1(localhost).

This is the result of my telnet try:

`➜ ios git:(master) ✗ telnet 192.168.1.11 60109
Trying 192.168.1.11...
Connected to localhost.
Escape character is '^]'.
^]
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Mono-HTTPAPI/1.0
Date: Sat, 18 Jun 2016 03:45:19 GMT
Content-Length: 52
Connection: close

Bad Request (Invalid request line (parts).)

Connection closed by foreign host. ➜ ios git:(master) ✗ telnet localhost 60109 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused Trying ::1... telnet: connect to address ::1: Connection refused Trying fe80::1... telnet: connect to address fe80::1: Connection refused telnet: Unable to connect to remote host ➜ ios git:(master) ✗ telnet 127.0.0.1 60109 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host ➜ ios git:(master) ✗ `

@jtbm37
Copy link
Contributor

jtbm37 commented Jun 18, 2016

@lishali12345 Check your host file. You need an entry for localhost.

@lishali12345
Copy link

@jtbm37 Do you mean I need an entry for localhost mapping to my remote ip address like 192.168.1.11?
I have an entry for localhost in my hosts file, like this:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

@jtbm37
Copy link
Contributor

jtbm37 commented Jun 18, 2016

@lishali12345 what I meant was to make sure you had an entry with localhost pointing to 127.0.0.1 because as you can see in the code linked above the http server will be listening on localhost.

@lishali12345
Copy link

Yes, I know that. But on my OSX EI Capitan, it just listen on my remote IP address in LAN, not on the local loopback address 127.0.0.1, which can view with the netstat -nat |grep LISTEN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants