Performance WCF, Nservice Bus and DI

Hi! I have a implementation with WCF and NServiceBus in Self host, and I have a big problem about performance.

In my WCF host I use DI and IEndpointInstance is injected, but when I take the first request to any method of the service there is a waiting time of 8+ seconds, before the first request is fast.

The problem may be by license?

My container DI is Autogfac:

How are you creating your IEndpointInstance? Are you creating it upfront and then passing the instance as a singleton or are you passing a factory method?

I would suggest to creating the endpoint instance as part of your host startup/bootstrap phase and then to pass this instance as a singleton to your DI container.

If you are unsure, then please share the code that shows how you are registering the IEndpointInstance.

1 Like

Hi, Ramon

I followed the same example here:
The difference is to inject the container into my wcf self-host.