Aaron Fischer
Aaron Fischer

Reputation: 21211

Problems with Self-hosting a WCF service

I have been evaluating whether to selfhost a wcf service in a windows service or IIS/asp.net

I am wondering what real world problems have you run into when self hosting WCF.

Upvotes: 3

Views: 902

Answers (2)

marc_s
marc_s

Reputation: 754478

Why is it you (and a great many other folks, too) are instantly assuming self-hosting would cause problems (or more problems than hosting in IIS) ??

We're using a bunch of self-hosted WCF services (inside Windows NT Services) almost exclusively, and I wouldn't want to have it any other way. For any serious production-ready hosting, I would always recommend self-hosting first.

Why?

  • I can fully control the URL for the service - no IIS forcing server name, virtual directory, port, and an *.svc file on me

  • I can start and stop those services at will, which is extremely useful in many scenarios

  • I have full support for all bindings and protocols - no fuss, no muss - it just works

  • I don't have to deal with application pool, app pool recycling and other annoyances of IIS

So again: why do you automatically assume self-hosting is going to cause problems?? It will actually prevent quite a few IIS issues!

Upvotes: 3

Aliostad
Aliostad

Reputation: 81660

I would say, this is mainly driven by your transport protocol.

If you use TCP or named-pipes, I will advocate self-hosting (yes I know IIS can do but I would like the flexibility of self-hosting). For HTTP however, I believe IIS is the way to go since it covers a lot of issues that would be a lot of work to implement in self-hosting.

Self-hosting a TCP or named-pipe service is quick and easy, no special gotchas there. Only on named-pipes, I must say named pipe hardening on Windows Vista/7/2008 has made the model much more complex and for me, pretty unusable.

Upvotes: 0

Related Questions