Unable to start Server. SocketException

41 views
Skip to first unread message

Kyro

unread,
Nov 26, 2015, 5:17:33 PM11/26/15
to XSockets.NET Developer forum
I have a url "site.mydomain.com" and a public ip address "200.200.100.50" and a private ip address of "192.168.1.2"

I can create a simple site (basic html page) in IIS with the binding set to site.mydomain.com on port 80 and it works fine (can browse to it with a browser). 
So I know that the network is functioning perfectly fine and that it isnt a firewall or incorrect ip address.

But if i stop the IIS site, and have a self hosted XSocket server (console application) with a Configuration of:

    public class Configuration1 : ConfigurationSetting
    {
        public Configuration1() : base(new Uri("ws://site.mydomain.com:80"), new Uri("ws://192.168.1.2:80")) { }
    }

I get a SocketException when the server is started. It reports the following error:

2015-11-26 17:11:32 [Information] "Starting Endpoint with" { Origin: ["*"], Host: "site.mydomain.com", Port: 80, IsLoopback: False, IsSecure: False, BacklogSize: 20, ThreadPoolSize: 200, CompletionPortThreads: 2, CertificateLocation: LocalMachine, CertificateSubjectDistinguishedName: "cn=localhost", ForceClientCertificate: False }


2015-11-26 17:11:32 [Error] Error in XSocketServer.Start()
System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddresssocketAddress)   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at
XSockets.Core.XSocket.Transport.DefaultTransport.Bind(EndPoint endPoint)
   at
XSockets.Server.XSocketServer.<Start>d__19.MoveNext()


There does not appear to be any XSockets documentation on this error.

What is going on? This looks to be pretty basic stuff that XSockets is failing with..

Ulf Björklund

unread,
Nov 26, 2015, 5:30:27 PM11/26/15
to XSockets.NET Developer forum
Hi Kyro

Sounds like something is still using port 80. I assume you killed IIS totally and not just the specific site?
To verify this just change port 80 to something else in the XSockets configuration. For example 4502

If you want to use XSockets on the same port as your web I recomend the Owin host option.

Regards
Uffe


Message has been deleted

Kyro

unread,
Nov 26, 2015, 6:59:19 PM11/26/15
to XSockets.NET Developer forum
I have other sites hosted in IIS that I cannot stop.

Is it possible to have an XSockets server self hosted (using Topshelf) on the same server that IIS is running other sites?
If so how would I go about it?

Ulf Björklund

unread,
Nov 27, 2015, 2:12:57 AM11/27/15
to XSockets.NET Developer forum
Sure, you can host XSockets pretty much anywhere as long as there is C# or Mono.
There is Topshelf instructions in the documentation.

However, you will not be able to use port 80 on the same machine as IIS (regardless of how you host) since IIS has taken that port.

Regards
Uffe
Reply all
Reply to author
Forward
0 new messages