Gnana
Gnana

Reputation: 53

WCF: Difference between hosting in IIS and WIndows service

WCF service can be hosted both in IIS and in Windows service. What are differences? Is there any benefit hosting in Windows service than IIS?

Upvotes: 4

Views: 9963

Answers (3)

Ashwin
Ashwin

Reputation: 441

Here are some differences (Features of IIS.. Copied from the link provided by @Jocke).

  • You lose all of the features of IIS (logging, application pool scaling, throttling/config of your site, etc.)...

  • You have to build every single feature that you want yourself HttpContext?

  • You lose that since ASP.NET provides that for you. So, I could see that making things like authentication much harder WebDeploy?

  • IIS has some nice specific features in 8 about handling requests and warming up the service (self-hosted does not)

  • IIS has the ability to run multiple concurrent sites with applications and virtual directories to advanced topics like load balancing and remote deployments.

Upvotes: 2

Jocke
Jocke

Reputation: 2294

Check out the documentation: https://msdn.microsoft.com/en-us/library/ms730158%28v=vs.110%29.aspx

It is awesome!

And the answer to your questions depends on what kind of application you are building and other requirements on the application/environment...!

Upvotes: 3

CodeCaster
CodeCaster

Reputation: 151740

If your WCF serivce is self-contained, like a data service, just host it in IIS. Drawback: you'll have to install and configure IIS.

If your WCF service is more of an API or IPC mechanism, used to let other applications talk to your application, it makes more sense to let your application self-host the WCF service, and for that a Windows Service usually is the more sensible approach. Drawbacks: you'll have to install your application as Windows Service, and configure that your application may listen on its configured port.

Please note that self-hosting is not constrained to Windows Services.

Upvotes: 1

Related Questions