ServiceStack/ServiceStack — pull request #315 by franklinwise (2012-10-29 22:49:49+00:00)
Title: Added support for multiple instances of service stack in the same app domain

Added Support for Multiple instances of service stack for the HttpListener. This enables multiple service stack servers running on different ports in the same app domain. This is particularly helpful for running integration tests against multiple enpoints that may have the same urls but different implementations.

To make the implementations in these classes thread safe and the methods more manageable to maintain, these files use "_" underscore for private member variable to make clear which variable are stack vars and which are heap vars for implementing critical sections in the code.

ServiceStack will continue to work the we it always has, however, if an implementer sets the runAsNamedInstance flag on an subclass of HttpListenerBase then that instance will run in named mode and can run next to other instances.

There is one open question, which is currently all instances use the same JsonSerializer, so on a config reload or load, all instances of SS must use the same JSONSerializer settings. We can use seperate instances, but I don't know that doing so is the best way to go.