问题
Is it possible with IIS 7.5 to host a secure https website on port 443 and to have a Java app run Socket.IO websocket on 443 also?
Currently we run the website on 443 and the secure websocket on another port 10001, but we are having issues with user firewalls and would like to move the websocket to a better "known default" port.
I know that IIS 8 has WebSocket capability but we would perfer not to have to upgrade our server instances to server 2012 unless we must.
回答1:
Two separate processes on a given IP address cannot both listen for the same incoming port. So, you can't have both IIS and a Java application listening for the same port. In addition, the webSocket protocol starts out as a web request (which the IIS server would handle) and then when certain "upgrade" headers are seen and both sides agree, the very same socket is then "upgraded" to the webSocket protocol which makes it hard to have two separate processes participating.
The only way I can think of to do this would be to build into IIS a "proxy" for webSocket. When an incoming connection to the IIS server has the webSocket upgrade headers, you would have to proxy that over to your Java application (on a different port) where it could then process things from there (while the actual socket continued to be proxied through IIS).
It is possible that there might be an actual product that could do this proxy separation that you could put in front of your IIS server to do this for you, but now I think you're getting enough complication that I'd wonder if you should really just go for the clean solution and upgrade.
Can you put the webSocket on port 80? Clients should be fine with that.
来源:https://stackoverflow.com/questions/28071948/iis-websocket-and-iis-sharing-port-443