Raj Kumar
Raj Kumar

Reputation: 7106

Writing Windows service in WCF

I want to write windows service in wcf After searching a lot I only found were tutorials of writing webservice in wcf not windows service.

Can any one please provide a link to any tutorial which explains how to write windows service in WCF

Upvotes: 3

Views: 935

Answers (4)

sebagomez
sebagomez

Reputation: 9599

Good answers all of them. Just a quick note... implement your WCF service in a class library (dll) so you can then host it anywhere you like (IIS, Console App, or Windows Service).
I'd recommend starting from a console application, after your service works as expected, create a Windows Service, add a reference to you library and start the service (WCF) from there (Windows Service)

Edit: I just assumed you meant create a WCF service hosted as a Windows Service, if that's not the case please ignore my answer.

Upvotes: 4

Matt Davis
Matt Davis

Reputation: 46034

To create a Windows service in C#, follow the step-by-step here. To make your Windows service WCF-enabled, if you will, create the System.ServiceModel.ServiceHost instance that will host your WCF service inside the OnStart() callback.

Upvotes: 4

blowdart
blowdart

Reputation: 56490

Windows services are executables. WCF applications are, generally, web services, exposed over a URI. You can host a WCF application within a windows service, not the other way around.

Upvotes: 5

Julien Lebosquain
Julien Lebosquain

Reputation: 41203

Create your WCF service as normal, create a Windows Service and then use ServiceHost to self-host the WCF service in your Windows Service. See this MSDN page for more information about self-hosting WCF services.

Upvotes: 2

Related Questions