Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi Guys,
I am very new to Windows & WCF service.I need to write service in C# using "windows service".
Is there any possibility to cal windows service from WCF without hosting WCF service.
Plz do help

Why not self-hosting? What is "to call windows service from WCF"?!!

1 solution

You can only run a Windows Service by the Service Controller. The Service Controller has API which you can use to Start/Stop/Restart service.

Use the class System.ServiceProcess.ServiceController, see[^].

Now, I have no idea what that supposed to mean, "to call Windows Service from WCF"? WCF is not a Service, Application or a process, this is Windows Communication Foundation, essentially, a library and technology. If you can make some .NET code using Service Controller API and/or WCF, you can control a Service from this code. It's up to you what is that.

This is all you need to solve your problem of controlling a Windows Service.

By the way, why not self-hosting WCF in your Service? In my opinion, a Windows Service is a perfect host for WCF server part. This is up to you though. I mentioned it just to bring your attention to this: are you sure you really understand what is WCF hosting? If you do — my apologies, good for you. However, it would be nice if you explain why not using self-hosting by your Service. If you have a better idea, I would do curious to know what is it.

thatraja 3-Jun-11 1:35am
Yes, OP should clarify that. But you gave him nice explanation.
Thanks again, Raja.
(It looks like you up-voted...)
thatraja 3-Jun-11 2:13am
Yep. You can assume that when you see my replies SA :)
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900