I have an API in mvc4
that call to .exe file via 'Process' class.
This .exe using log4net, and run another .exe that export files to directory and subdirectories. In the end of the process, the .exe post to http API.
Process p = new Process();
p.StartInfo.FileName = ConfigurationManager.AppSettings["ExtractToolPath"];
p.StartInfo.Arguments = this.strcommand;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.Verb = "runas";
p.StartInfo.RedirectStandardInput = true;
p.Start();
string s = p.StandardOutput.ReadToEnd();
p.WaitForExit();
String 's'
returns with "" (blank string).
The s
paramter get what was printed to the Console window. And I did a print in the begining of the .exe, therefor I know it even not started the process.
Important: When I remove the log4net logger, the 's'
parameters gets some output, but it's failes when tring to do any command that requieres write permissions.
I tried to give the IIS executable permission, and immpersonation with admin username and password. I did my directories 'share' to everyone. Nothing helped.
Did you try setting the application pool identity to an administrator? Or giving write permissions on the directory to the application pool identity?
The credentials used to do the writing are the ones in the application pool identity.
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