Slow startuptime

We have a fairly large WPF client with about 80 different projects in the same solution.

During startup, NServiceBus takes about 7 seconds to return from the Start method.

Are there any way that I can decrease that time?

Hi @jgauffin,

I have a hunch that the assembly scanning process it’s taking a lot of time due to the amount of assemblies in the bin directory. You can teak it by excluding assemblies you already know are not interesting from the endpoint perspective.

For more information refer to this article in the documentation:


… search of related interfaces …

What does that mean? Do it search for all IHandleMessage implementations, or what assemblies are expected to be included?

I’ve also limited it to 51 assemblies now (with all NSB assemblies included as I’m unsure of what should be included). Still slow.

What happens is that by default all assemblies in the bin folder are scanned looking for interfaces that are important for NServiceBus, such as IHandleMessages<T>, and/or IMessage, IEvent, ICommand, or classes that implement features or installers.

If there are 50 assemblies in the bin folder, 50 assemblies are scanned. For large solution it makes sense to configure the scanner to exclude that don’t contain anything related to NServiceBus.


Well yes, I got a scanner. With all WPF assemblies it’s a lot of assemblies in that folder.

I’ve limited the scanner to only assemblies that contains message handlers. Why do NSB need to find assemblies with message implementations (i.e. implementations of IMessage etc)?

No, it doesn’t need to, my bad. It was just a bad sample.

  • Are those assemblies big files in terms of file size on disk?
  • Is there an option for you to make the NServiceBus endpoint creation async to the WPF application startup?

Make sure that you do not have endpointConfiguration.EnableInstallers() invoked for regular startup as that can cause increased startup time too:

@jgauffin Looking at the screenshot of the profiler that you included, can you expand into the CreateWithInternallyManagedContainer and CreateStartableEndpoint nodes so we can see more details?

Will do. I’m back on track now when I’ve solved my other issue.