tags:

views:

946

answers:

6

Is it true that a WCF either runs as a console application that you have to manually start OR under a more traditional IIS application (like a website or webservice)

A: 

Yes, that's correct... you can also host them as a Windows Service

sebastian
A: 

Part of the objective of WCF is to free you up from limitations on where the service is running. You can also use Windows Activation Service (WAS) for Vista and Windows Server 2008.

DOK
+6  A: 

EDIT: No, that is not quite true.

Those are two hosting options for WCF. There are others.


orig answer:

you can actually execute a wcf service everywhere, where you can execute managed code. i've seen wcf services running inside sql server, wpf apps, windows services and even one running on a linux box on mono.

Joachim Kerschbaumer
+8  A: 

you can start a WCF host process in a:

  • Windows Forms App
  • Console App
  • Windows Service
  • IIS 6 (Only HTTP hosting)
  • IIS 7 - WAS (All bindings supported)

Each of them has advantage or disadvantages. This page gives great information about hosting options: http://msdn.microsoft.com/en-us/library/bb332338.aspx.

mucit
+1  A: 

There is a class ServiceHost defined in WCF that allows you to host a service in any application like so:

using (ServiceHost host = new ServiceHost(typeof(MyService))
{
   host.Open();

   WaitForClose();

   host.Close();
}

IIS running in Windows XP SP2+, Vista, 2003 or 2008 can host WCF services.

jezell
A: 

I have a WCF service that needs to run as a service in IIS 7. The problem is that in order for it to start I need to manually invoke it through the browser e.g. http://site/myservice.svc.

Is there a way to have IIS call out and start the service host / wcf service when the application pool is restarted?

My preference would be to avoid a windows service and go with IIS / WAS

This should probably be a separate question of its own instead of a response.
Bill the Lizard