How to host websocket-sharp server on IIS

2019-07-23 07:20发布

问题:

I have a hostname like dev.websocketserver.com.

Now I want to host my websocket-server on this hostname in IIS, so that my socket address becomes ws://dev.websocketserver.com/Echo

What should I create WCF service, windows service? Socket will listen on port that is not already in use. So if I host my WCF service under host dev.websocketserver.com and in Global.asax create a server then it will not get bound with Port 80.

Can anyone tell me what should be the basic architecture for hosting websocket-server over IIS?

回答1:

As far as I know, you can't.

websocket-sharp needs to run in its own port, so you cannot have both IIS and it in the same port.

You can run both in the same host and have ws://dev.websocketserver.com:8000 for example.

IIS 8 and further supports WebSockets, so you can use the built in WebSockets in ASP.NET rather than websocket-sharp.