title: How to call method from running windows service
body: <p>I have created and started windows service Service1 (with exe as MyService.exe) using c# 2005. .
  I have included a method GetMyRandomNumber() that returns a random double value.</p>
  
  <p>The problem here is how could use this running service and how could i call the method.</p>
  
  <p>I have tried adding reference of MyService.exe and access the method as -</p>
  
  <pre><code>Service1 s = new Service1();
  MessageBox.Show(s.GetMyRandomNumber().ToString());
  </code></pre>
  
  <p>But found that the method is not called from the running instance of the service i.e. even though i stop the service the statements are executed.</p>
  
  <p>Could someone explain me how can I call the method from running instance of the service.</p>
  
  <p>Thanks for sharing your valuable time.</p>