4

I've written my first windows service in .Net. Can I communicate with this service from other .Net application? Can I execute methods on a service object from remote .net applications?

1
  • 3
    Service is just a program that runs automatically regardless of user login. The nature of being a service doesn't allow remote method calls. You should host something like WCF, Remoting, ... to allow it. Aug 16, 2009 at 18:55

2 Answers 2

8

Yes. A Windows Service (or just about any other kind of .NET program) can host a WCF Service. Clients can call this service in order to make requests.

0
5

WCF is definitely the .NET way of doing this. If you are not familiar with WCF, I would suggest starting with this dnrTV video: Keith Elder Demystifies WCF. It does a pretty decent job of explaining how simple WCF is. For your situation, just host the WCF service in the OnStart() method of your Windows service. At that point, any remote application can connect to your WCF service hosted in your Windows service.

When you feel comfortable with WCF itself, you can check out this dnrTV video: Extreme WCF. This one gives you some best practices of how to "do" WCF inside Visual Studio.

To buttress these two videos, check out Juval Lowy's website, IDesign.net. Juval has a lot of examples and usable WCF code that's freely available.

1
  • You helped me a lot. Thanks for great links!
    – mgamer
    Aug 16, 2009 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.