Another one of those rules of thumbs that I hear often quoted but rarely demonstrated covers the performance of hosting a web service in IIS. Running a WCF service host in IIS is going to be more expensive than running that same service host in your own process. However, I’ve heard people quote figures of sixty, eighty, or even one hundred percent increases in throughput by self hosting. I have difficulty believing that in real practice the throughput is going to double by hosting a web service in your own process rather than in IIS. I would be less skeptical about numbers closer to twenty percent. Nevertheless, you should expect to see a difference because IIS is providing additional services for you.
In my mind, these are the most valuable services that you’re trading off for that performance.
- Application configuration, management, and diagnostics through the IIS management tools
- Easier deployment and security setup assuming that IIS is already installed
- Demand based activation of services
- Health monitoring and automatic crash recovery
- Better compatibility with ASP.NET behavior
Conversely, if you find yourself trying to add these features to a self hosted web service, then you may want to think about using IIS instead because it will probably beat your implementation on performance.
Next time: AfterInvoke Must Run