<p>I've been looking at ways to implement gmail-like messaging inside a browser, and arrived at the <a href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="noreferrer">Comet</a> concept. However, I haven't been able to find a good .NET implementation that allows me to do this within IIS (our application is written in ASP.NET 2.0). </p>

<p>The solutions I found (or could think of, for that matter) require leaving a running thread per user - so that it could return a response to him once he gets a message. This doesn't scale at all, of course.</p>

<p>So my question is - do you know of an ASP.NET implementation for Comet that works in a different way? Is that even possible with IIS? </p>

[{'answer_id': 69172, 'author': 'cruizer', 'author_id': 6441, 'author_profile': 'https://Stackoverflow.com/users/6441', 'pm_score': 0, 'selected': False, 'text': "<p>I think the Comet approach isn't really scalable unless you are prepared to expand the web farm horizontally (by adding more web servers to the mix). The way it works is that it leaves a TCP connection open per user session, just so the server can push stuff into that connection from time to time to immediately inform the user of a change or activity.</p>\n"}, {'answer_id': 69319, 'author': 'Scott Hanselman', 'author_id': 6380, 'author_profile': 'https://Stackoverflow.com/users/6380', 'pm_score': 6, 'selected': True, 'text': '<p>Comet is challenging to scale with IIS because of comet\'s persistent connectivity, but there is a team looking at Comet scenarios now. Also look at <a href="http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/" rel="noreferrer">Aaron Lerch\'s blog</a> as I believe he\'s done some early Comet work in ASP.NET. </p>\n'}, {'answer_id': 782950, 'author': 'Vikram', 'author_id': 95107, 'author_profile': 'https://Stackoverflow.com/users/95107', 'pm_score': 2, 'selected': False, 'text': '<p>You might also look at the <a href="https://kaazing.com/products/websocket-gateway/editions/" rel="nofollow noreferrer">Kaazing Enterprise Gateway</a> which has made a production release of their webSocket [HTML5] gateway which supersedes the comet way completely and enables full-duplex connections between browsers &amp; application servers.</p>\n\n<p>You might also look at <a href="http://www.lightstreamer.com/demos.htm" rel="nofollow noreferrer">Light Streamer Demos</a> </p>\n'}, {'answer_id': 1190185, 'author': 'Anton', 'author_id': 76378, 'author_profile': 'https://Stackoverflow.com/users/76378', 'pm_score': 5, 'selected': False, 'text': '<p><a href="http://www.frozenmountain.com/websync" rel="noreferrer">WebSync</a> is a standards-compliant scalable Comet server that integrates directly into the IIS/.NET pipeline.  It\'s also available on demand as a hosted service.</p>\n\n<p>It officially supports up to 20,000 concurrent client connections per server node, but individual tests have seen it go as high as 50,000. Message throughput is optimal around the 1,000-5,000 concurrent clients mark, with messages delivered as high as 300,000 per second from a single node.</p>\n\n<p>It includes client-side support for JavaScript, .NET/Mono, iOS, Mac OS X, Java, Silverlight, Windows Phone, Windows Runtime, and .NET Compact, with server-side support for .NET/Mono and PHP.</p>\n\n<p>Clustering is supported using either SQL Server or Azure Caching out of the box, but custom providers can be written for just about anything (Redis, NCache).</p>\n\n<p><strong>Disclaimer:</strong> I work for the company that develops this product.</p>\n'}, {'answer_id': 1580974, 'author': 'Chris', 'author_id': 34942, 'author_profile': 'https://Stackoverflow.com/users/34942', 'pm_score': 1, 'selected': False, 'text': '<p>I once used a chat site long ago that utilized a custom built http streaming server. I actually reproduced that software at one point out of sheer curiosity, and it\'s easy enough to do, I think. I would never try to implement a similar type of "infinite request" in IIS, especially in ASP.NET, because the requests tie up a thread pool thread (or IO thread, if asynchronous handlers are used) indefinitely, which means you can only handle so much per server as your thread pool configuration allows.</p>\n\n<p>If I had a strong legitimate need for such functionality, I\'d honestly write a custom http server for it.</p>\n\n<p>I know that doesn\'t really answer your question, but I thought the input might be relevant.</p>\n'}, {'answer_id': 3291268, 'author': 'BigbangO', 'author_id': 396927, 'author_profile': 'https://Stackoverflow.com/users/396927', 'pm_score': 2, 'selected': False, 'text': '<p>Actually there are many choices to create ajax supported website with ASP.NET but honestly, <strong><a href="http://pokein.com" rel="nofollow noreferrer">PokeIn</a></strong> is the easiest way to create an comet ajax supported web application. It has saved one of the projects of my company. </p>\n'}, {'answer_id': 5650794, 'author': 'Jacob', 'author_id': 133701, 'author_profile': 'https://Stackoverflow.com/users/133701', 'pm_score': 4, 'selected': False, 'text': '<p>I recently wrote a <a href="https://bitbucket.org/jacob4u2/mvcchatsite/src" rel="noreferrer" title="MVC Chat Site Source On BitBucket">simple example of a Long Polling Chat Server</a> using MVC 3 Async Controllers based on a <a href="http://clay.lenharts.net/blog/2010/10/19/websockets-is-cool-but-what-can-you-do-today/" rel="noreferrer">great article by Clay Lenhart</a></p>\n\n<p>You can use the <a href="http://mvcchatsite.apphb.com" rel="noreferrer">example on a AppHarbor deployment</a> I set up based on the source from the BitBucket project.</p>\n\n<p>Also, more information available from my <a href="http://jacob4u2.posterous.com/mvc-3-long-polling-comet-chat-example" rel="noreferrer">blog post explaining the project</a>.</p>\n'}, {'answer_id': 5724714, 'author': 'makerofthings7', 'author_id': 328397, 'author_profile': 'https://Stackoverflow.com/users/328397', 'pm_score': 1, 'selected': False, 'text': '<p>The WS-I group published something called <a href="http://www.ws-i.org/deliverables/workinggroup.aspx?wg=reliablesecure" rel="nofollow noreferrer">"Reliable Secure Profile"</a> that has a Glass Fish and <a href="http://msdn.microsoft.com/en-us/library/ee818238.aspx" rel="nofollow noreferrer">.NET implementation</a> that apparently <a href="http://msdn.microsoft.com/en-us/library/ff842400.aspx#requestResponse" rel="nofollow noreferrer">inter-operate</a> well.</p>\n\n<p>With any luck there is a <a href="https://stackoverflow.com/questions/5724558/is-there-a-javascript-implementation-for-ws-i-reliable-secure-profile">Javascript</a> implementation out there as well.</p>\n\n<p>There is also a Silverlight implementation that uses <a href="http://msdn.microsoft.com/en-us/library/cc645027%28v=vs.95%29.aspx" rel="nofollow noreferrer">HTTP Duplex.</a>  You can <a href="https://stackoverflow.com/questions/5449642/http-push-comet-reverse-ajaxusing-silverlight-to-javascript-bridge">connect javascript to the Silverlight</a> object to get callbacks when a push occurs.</p>\n\n<p>There are also <a href="https://stackoverflow.com/questions/5427681/how-do-modern-implementations-of-comet-reverse-ajax-work-any-stable-c-wcf-or-as">commercial paid versions</a> as well.</p>\n'}]
['https://Stackoverflow.com/questions/65673', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3389/']