Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13521

WCF Service hosted in a Console Application

How much load can a WCF service, hosted in a console application handle? Can it handle incoming requests as much as a WCF hosted on IIS?

Additional Notes: Can requests arrive concurrently?

I have a WCF service hosted in a console app. I call this WCF service from within a web app. That web app may have hundreds of requests concurrently.

I have simulated a load of requests but I couldn't find out if the console app which hosts the WCF service is actually answering them concurrently or sequentially.

Upvotes: 4

Views: 971

Answers (2)

Marcel N.
Marcel N.

Reputation: 13986

It doesn't matter where the WCF service is hosted. It all depends on the binding, endpoint, endpoint behavior and service behavior settings and, last but not least, on the way you set (via attributes) the instancing mode and concurrency type for your service.

These settings are taken over by the ServiceHost instance. Even if it's running in a console app, the application itself is just a container for the ServiceHost which is the one that creates the runtime environment for your WCF service, based on the settings you give it.

For what interests you, see here (concurrency and throttling). Also, something very extensive on WCF instance modes.

For performance reasons I recommend you use a singleton service, which you can specify via the InstanceContextMode. If you have hundreds of requests coming in, it won't do any good to concurrency if a service instance is created for each request. You have to analyze if singleton is possible in your case by checking if all your service operations are thread safe.

Upvotes: 7

abatishchev
abatishchev

Reputation: 100366

How much load can a WCF service, hosted in a console application handle?

As much as your computer can for self-hosted WCF service.

The host can be a console app or windows service, doesn't matter, from load perspective they are the same.

Upvotes: 1

Related Questions