It looks like WCF only uses one thread when using self hosting. I'd like to use several threads or a thread pool of some kind for this. Is it possible with self hosting configuration or I need to use IIS for this?
If you self host the service in UI application with default service behavior setting you will probably see the behavior you are describing. Default service behavior uses synchronization context. In case of starting the service host in the UI thread (WinForms, WPF) all requests are routed to the common windows message loop => all requests are handled sequentially by UI thread.
In any other case (including manually setting [ServiceBehavior(UseSynchronizationContext = false)]
for services hosted in the UI thread) the service host dispatches new thread from the thread pool for each request. There are some further differences based on instance context mode and concurrency mode but with default settings you will see the behavior I described.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With