How to call a method from a Windows service

I created and launched Windows Service Service1 (with exe as MyService.exe) using C # 2005 .. I included the GetMyRandomNumber () method, which returns a random double value.

The problem is how to use this running service and how can I call the method.

I tried to add the MyService.exe link and access the as method -

Service1 s = new Service1();
MessageBox.Show(s.GetMyRandomNumber().ToString());

But I found that this method is not called from the executable instance of the service, i.e. although I am stopping the service performed by the operators.

Can someone explain to me how I can call the method to start the service instance.

Thank you for sharing your valuable time.

+5
source share
5 answers

, ( .NET Framework , ).

, , .

.NET 2.0 .NET Remoting. , .

.NET 3.0 WCF. WCF, GetRandomNumber() . .

.NET Remoting , Windows Communication Foundation.

+14

. , .

Windows Communication Foundation (WCF) . WCF Windows Named Pipe .

+2

WCF . Pipes - .

+2

All Articles