What is the difference in using WCF with netTcpBinding
for long running task, which is hosted in IIS vs self-hosted in a managed windows service for LONG RUNNING TASK?
2 Answers
I think there are pros and cons associated with hosting WCF services in either IIS or a self-hosted managed service. The technical details and opinions surrounding the hosting decision are discussed/debated fairly thoroughly in this thread:
IIS WCF service hosting vs Windows Service
Our team almost always uses self-hosting in managed Windows services, so my thinking aligns with the answer provided by marc_s (10/13/09).
As the following article seems to confirm, I think hosting long running “tasks” in a self-hosted managed service is sound design choice.
http://msdn.microsoft.com/en-us/library/ms730158.aspx
Regards,
Hosting WCF Service in IIS has benefits such as managing service lifetime (Activation, Recycling,...) so you don't have to worry (or write custom code to do this), IIS also activates the service on demand so your resources are used when needed

- 596
- 5
- 13
-
then why hosting wcf service in windows service is mentioned as preferred option for long running task? I can understand http is meant for short living. then why not net tcp binding in IIS? – Dev Sep 15 '14 at 13:04
-
1Maybe because of the process recycling, in which you do not know or control when your process is recycled. Please check http://msdn.microsoft.com/en-us/library/bb332338.aspx for more information – Ahmad Al Sayyed Sep 15 '14 at 13:20