Saturday, April 10, 2010

Deploying a C# WCF project as an installable service:

1) Create a new WCF Service Library

2) Add a new Windows Service project to the solution

a. Right click on Service1.cs and select view code and modify the OnStart and OnStop to startup and stop your WCF

b. Double click on Service1.cs

a. Right click in the window and select “Add Installer”

b. You should now see serviceinstall1 and serviceprocessinstaller1

Check the properties under these two and modify as required.

3) Add a new project “Setup Project” to your solution.

a. Right click on the project and select Add and then Project Output

b. Select your Windows service project and select Primary Output and hit OK

c. Right click on the project and select View and then Custom Actions

d. Right click on custom actions and select Add Custom Action

Double click on Application Folder and select your primary output and hit ok

After you build the “Setup Project” you will be able to run the “msi” file to install your service anywhere.

No comments:

Post a Comment