Ali Avcı
Ali Avcı

Reputation: 1301

Service running but no message box shown

I have a service and I'm starting this service from a form:

ctl = ServiceController.GetServices().Where(s => s.ServiceName == "ServiceA").First();
ctl.Start();
MessageBox.Show(ctl.Status.ToString());//Running

I checked the service in the Task Manager of windows 8 and it is running. However I added a code like that :

public ServiceA()//constructor method
{
MessageBox.Show("Started");
}

But when the process is running, I can't see any message box which has its content like "Started". What is the problem?

Upvotes: 1

Views: 207

Answers (1)

Bikonja
Bikonja

Reputation: 899

Windows services do not allow showing of message boxes. You can refer to this Stack Overflow question for more details.

Upvotes: 2

Related Questions