Multiple IIS Sites hosting the same application and NServiceBus

Multiple IIS Sites for the same application

When the same application is hosted in multiple sites in IIS, and the application is hosting a NServicebus endpoint, then it is important to ensure that each site has a different end-point names. Otherwise all web-site read events from the same queue, and each site only receives a portion of the messages. This sound obvious, but a bug related to this bugged me for a long time…

Losing SignalR messages

In a specific application where we use SignalR we noticed really strange behavior. Only some events were transported from our NSB processor, to the SignalR client. Strangely enough all events were logged in our application logging. Further investigation pointed out that the NSB events were processed by multiple App-Domains in the same process. Where-after we found out that the same application was hosted in multiple IIS sites with different bindings and configuration. This explained off-course how we end up with multiple processors reading from the same queue, and why we only received some messages on our SignalR client.


NServiceBus configuration

The fix is easy, instead of using the default or a static end-point name, we define a dynamic end-point name based on the IIS Site name.