Answer the question
In order to leave comments, you need to log in
Comet-like daemon on Windows Server 2008R2 on port 80 with IIS running
Task conditions:
1. There is a server under Windows Server 2008R2 Enterprise.
2. IIS 7.0 is running there as a “combat” web server.
I want to make it so that for a certain website, IIS forwards GET requests to the / daemon address
to the local service (via a socket connection or something else), and the rest of the requests worked out on his own.
The connection itself should not be closed at the same time: the local service will play the role of a Comet-like daemon and send messages to the stream for a long time.
Moreover, this whole structure must withstand several thousand simultaneously open sessions to the daemon + work out the usual requests for the return of statics and server logic.
So you have to bother in order not to have problems with firewalls and cross-domain security in JavaScript. For the end browser, whether the request to the daemon or just to the web server must be identical - the same domain, the same port - only the URIs are different.
In UNIX-like systems, this task was solved by writing modules for nginx and Apache, but in programming under Windows in general and .NET in particular, I am not strong, unfortunately :(.
Is such a task solvable in principle?
Google advises NET.TCP Port Sharing (http://msdn.microsoft.com/en-us/library/ms734772.aspx)
Will this technology work for the task,
or are there simpler options?
Answer the question
In order to leave comments, you need to log in
Write an HTTP Handler using ASP.NET. So you can "catch" all requests and determine what to do with them. HTTP Handlers work almost like an ISAPI Extension, so they are pretty fast. You also have full control over the connection.
The first link from Google: www.15seconds.com/issue/020417.htm
Of course, MSDN will give more information.
Port sharing is one application of the more general HTTP API
technology.
If you run
netsh http show servicestate
, you can see who is currently subscribed to which urls. This is, if at all, an independent application that can be launched even from the user, even from another service.
But if you want, you can also write an ISAPI plugin for IIS.
I would take out IIS for nginx, and nginx would already resolve it, give the request to IIS or this one of yours.
In case someone is wondering how this task was successfully solved:
1) A NodeJS script was used as a cross-platform daemon
2) On the Windows platform, the connection from the IIS web server is forwarded to the daemon using the IISNode module from Tomasz Yanchuk working at Microsoft. The module is free, often updated, the author is adequate and answers in the bugtracker.
Changes in the code of the demon "under Windows" - as much as one line.
Your obedient servant took part in testing the early branches of the module :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question