2

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?

Seymour
  • 7,043
  • 12
  • 44
  • 51
Dev
  • 309
  • 1
  • 8
  • 24

2 Answers2

3

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,

Community
  • 1
  • 1
Seymour
  • 7,043
  • 12
  • 44
  • 51
1

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

Ahmad Al Sayyed
  • 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
  • 1
    Maybe 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