Hosting WCF in IIS 7.5 vs Windows Service for Performance Considerations
Asked Answered
L

1

11

I have a simple and direct question: is there any performance benefits (or any other type of benefit) I am unaware of when comparing hosting of a WCF service in IIS 7.5 vs. a Windows Service?

I am not in the dark on this topic and have actually hosted several WCF services in both hosting environments. However I was about to start a new service that has some heavier use and wanted to 're-visit' the topic. Right now I am leaning towards a Windows Service.

I have read posts like the following: IIS WCF service hosting vs Windows Service which gives some good information, but is a bit out of date (yes even only at 1.5 years old; still using codename 'Dublin Technologies').

There is no ding against Windows Services for me because I am quite comfortable with setup, deployment, and configuration (including applying an SSL cert to a port hosting the WCF service), so this is not a big deal to me vs. IIS.

I always thought application recycling in IIS would be a downside to hosting a WCF service, allowing potential for small possible breaks in communication. I know with a .asmx IIS hosted service (converting to WCF) that I have received random '401 Unauthorized' (I mean really random like every 5-10,000 calls kind of thing) and I marked that up to idiosyncrasies with IIS and its ability to keep communication up 100% of the time without the app pool being recycled (possibly causing issue? -> this issue is not in question here and just for reference).

So I wonder about IIS.

I would like a present-day perspective (a lot of the MSDN comparison charts are out of date too, always comparing to IIS 6) on hosting a WCF service on Windows Server 2008 R2 in a Windows Service vs. IIS 7.5. Thanks!!

Lemming answered 11/5, 2011 at 12:55 Comment(0)
T
5

With the release of AppFabric for IIS, hosting WCF services on IIS 7.5 has gotten a bit easier and more reliable. AppFabric allows you to configure services to start up on application pool start and prevent the pool from recycling like a normal web application. It also provides methods to allow your WCF service to log information about its health and monitor the service.

For my most recent WCF project, I've gone with ASP.Net 4 and AppFabric with .svc extensions for hosting the code. (Currently, AppFabric has issues monitoring services that are routed - so an .svc file is required)

Here are a couple more useful links about WCF and AppFabric:

Another advantage I've seen in the IIS method is it allows you to create pages next to it to help monitor, maintain, and configure the services. With a Windows Service you have to either edit your config files by hand or create an application to handle it for you. The ability to host WCF next to WebForms/MVC applications for management is a huge plus in my book. Obviously, you'd need to make sure it's secured in some way to prevent others from peering in and seeing the status/configuring it.

Timekeeper answered 11/5, 2011 at 14:54 Comment(3)
Lovin' the new App Fabric. I love WCF, so all this new stuff isChing
AppFabric does not actually host the WCF service though correct? It just offers monitoring enhancments as I read. AppFabric is not a free install either, and must be installed on the server right? Not show stoppers, but sometimes getting new software on the server takes an act of congress.Lemming
You are correct, AppFabric does not actually host the WCF service. AppFabric is a free add-on to IIS. So if you can legally host WCF through IIS on W2k8R2, you can use AppFabric. In addition to the monitoring capabilites it provides it can also provide a startup method to warm the service up and keep it alive without recycling.Timekeeper

© 2022 - 2024 — McMap. All rights reserved.