I want to load a form in OnStart() method in my windows service; here is my code. It is not working. Can you please provide any help ?
protected override void OnStart(string[] args)
{
Form1 fr = new Form1();
fr.Show();
}
You can't use services that way. Services can't interact with desktop directly, because they run in another WindowsStation from the logged in users session. You need to create another application that will communicate with your service.
How to make communication you can read on MSDN and in this example. Some ideas also described already on StackOverflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With