2

What are the pros and cons of hosting a WCF service in IIS versus using a Windows service?

FYI - I have googled but it's surprisingly hard to find relevant answers.

Bob Horn
  • 33,387
  • 34
  • 113
  • 219
  • 1
    http://msdn.microsoft.com/en-us/library/bb332338.aspx – Jocke Jun 11 '13 at 19:59
  • Thanks! That's six years old. Do you know if it's still relevant? – Bob Horn Jun 11 '13 at 20:00
  • It's probably better to ask what the requirements of your service are, and then decide on how best to host it. – Tim Jun 11 '13 at 21:09
  • Looks like my question is a duplicate. I found some good answers: http://stackoverflow.com/a/1225985/279516 and http://stackoverflow.com/a/1560784/279516. – Bob Horn Jun 13 '13 at 18:25
  • possible duplicate of [Should I host my WCF service in IIS?](http://stackoverflow.com/questions/1225851/should-i-host-my-wcf-service-in-iis) – Bob Horn Jun 13 '13 at 18:26

1 Answers1

1

We've just implemented a big WCF service, and did it as a self-hosted windows service. The reason we did it that way was our architects wanted the extra control you get from hosting your own and taking IIS out of the equation. Basically, when you go the self-hosted route,

  • you process each request
  • you configure your own endpoints
  • you configure your certs
  • you control the exception handling
  • etc.

Our WCF service is industrial scale with rev proxies, load balancing and about 50 methods attached to the endpoints. And we use multiple encryption protocols depending on the types of devices connecting.

However, if I was doing a smaller WCF web service with just a single server, a single endpoint and a few method calls, I'd probably use IIS to manage the endpoint and implement the SSL letting the UI do the configuration work that would otherwise have to be done in code. It's just easier from what I've seen.

Long story short, if you host it, you control everything in code. If you're interested in a quicker delivery, I'd start with IIS.

Brian
  • 3,653
  • 1
  • 22
  • 33
  • +1 Thanks for the tips. It would help me to have a little more detail on those bullet points. For example, how is the exception handling model different between the two? Why would you want to configure your own endpoints? What is the advantage of processing your own request? – Bob Horn Jun 13 '13 at 18:11
  • Brian: If you are able to expand your answer in regards to my above comment, then I think this answer would be different enough to not be considered a duplicate, and therefore worthwhile to keep open. – Bob Horn Jun 13 '13 at 18:27