How to start a process in another machine in c#?
I am trying to start a print process in another machine. i even gave the username and password in the same machine. I am getting Access denied issue while running as service.As application print process works.
private void PrintFile(string sFileName, string sPrinter)
{
string sArgs = " /t \"" + sFileName + "\" \"" + sPrinter + "\"";
System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = System.Configuration.ConfigurationManager.AppSettings["AcrobatExePath"].ToString();
startInfo.Arguments = sArgs;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
System.Diagnostics.Process proc = Process.Start(startInfo);
proc.WaitForExit(60000);
if (!proc.HasExited)
{
proc.Kill();
proc.Dispose();
}
}
What I have tried:
private void PrintFile(string sFileName, string sPrinter)
{
string sArgs = " /t \"" + sFileName + "\" \"" + sPrinter + "\"";
System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = System.Configuration.ConfigurationManager.AppSettings["AcrobatExePath"].ToString();
startInfo.Arguments = sArgs;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
System.Diagnostics.Process proc = Process.Start(startInfo);
proc.WaitForExit(60000); // Wait a maximum of 10 sec for the process to finish
if (!proc.HasExited)
{
proc.Kill();
proc.Dispose();
}
}