Friday, June 19, 2009

WCF Self Hosting Project Template


Visual Studio 2008 comes with project templates for a WCF web site and a WCF service library. But what about self hosting?

I've create a simple self hosting template which you can use when starting new projects. This is useful for real projects as well as for quick POC/prototyping projects. For the latter it brings the following advantages over the out of the box templates:

  • It encapsulates the service as an executable so it can be easily deployed without messing with IIS (xcopy is enough)
  • It enables to use transports which are not supported in web sites (e.g. netTcp).


    1. Save this template

    (if you do not see the file use this direct link)

    in this location:

    %My Documents%\Visual Studio 2008\Templates\ProjectTemplates\Visual C#\WCF

    Note 1: save the zip file itself, no need to extract it
    Note 2: If the WCF subfolder does not exist then create it

    2. The template now appears in VS "new project" window under the Visual C# \ WCF node.

    3. After you create the project press F5 to run it - all the information you need to know is printed to the console.

    Enjoy :)


    What's next? get this blog rss updates or register for mail updates!