I have made a WCF Service and it contains a method string SaveVideoInformation()
The purpose of this method is to run a process if it is not running. Following is the code of that method.
public string SaveVideoInformation(string ID, string videoName)
{
string Result = null;
try
{
Result = Insert(ID, videoName);
Process[] pname = Process.GetProcessesByName("AutoRunVideoWaterMarkingTook");
if (pname.Length == 0)
{
Result += " | Trying to run Process";
try
{
Process process = Process.Start(@"~\Debug\AutoRunVideoWaterMarkingTook.exe");
Result += " | Process Ran Successfully";
}
catch (Exception ex)
{
Result += " | Exception While Running the process";
throw new Exception("Unable to start Process);
}
}
else
{
Result += "|Process Already Running";
}
}
catch (Exception ex)
{
Result = "Not Done," + ex.Message;
}
return Result;
}
The problem I am facing is when i call this method from Windows Form Tool Application, it run successfully and i can see the UI.
but when i call this method from Windows Service, Process Starts but its UI is not visible.
That is most likely because your Windows Service is not in user interactive mode.
You have to enable this from the Services panel, as described in this blog: Check the Allow service to interact with desktop
in the service properties Log On
page.
Also read Microsofts recommendations on user interactive services.
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