I’ve written this code to start a process:
var proc = new Process();
proc.StartInfo.Arguments = string.Format("{0} {1}", inputFilePath, outputFilePath);
proc.StartInfo.FileName = @Settings.GetImageMagickConvertPath();
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.UseShellExecute = false;
proc.Start();
This works perfectly locally. But when I put this code on a remote machine, this code no longer works (Error is “Access is denied” when trying to start the proc). So, I’ve added the credentials I use to connect using RDC (user/pass) in order to start the process:
proc.StartInfo.UserName = "user";
System.Security.SecureString secret = new System.Security.SecureString();
foreach (char c in "pass")
secret.AppendChar(c);
proc.StartInfo.Password = secret;
but I still receive the same error…
Do you guys see anything which can be fixed for this issue?
Ok, it’s solved now.
Basically I had two issues:
The path to the process to start was incorrect (instead of
folder/program.exeI put by mistakefolder/and I received “Access is denied” which made my life a nightmare (started to look for rights, account etc). Would have been nice if Microsoft have been improved this error like “The path to the process is wrong”).I had to run it as a Local Service (app pool) instead of App Pool Identity. (and no need for Start Info credentials)
Operating system involved: Windows 2008 Server R1)