process.StandardOutput.ReadToEnd returns null
本文关键字:null returns ReadToEnd StandardOutput process | 更新日期: 2023-09-27 18:01:24
我有这样的代码:
在c# Windows的形式工作正确…但是在asp.net中它返回null
var tempCadena = HttpContext.Current.Server.MapPath("~/" + HttpContext.Current.Session["db"] + "/" + "cadena");
System.IO.File.WriteAllText(tempCadena, cadena);
// Digestion SHA1
var tempSha = HttpContext.Current.Server.MapPath("~/" + HttpContext.Current.Session["db"] + "/" + "sha");
var opensslPath = HttpContext.Current.Server.MapPath("~/openssl/bin/openssl.exe");
Process process = new Process();
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo.FileName = opensslPath;
process.StartInfo.Arguments = "dgst -sha1 " + tempCadena;
process.StartInfo.UseShellExecute = false;
process.StartInfo.ErrorDialog = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string codificado = "";
codificado = process.StandardOutput.ReadToEnd();
process.WaitForExit();
codificado = null有人能帮帮我吗?
我试图改变进程为ProcessStartInfo和不工作
我找到了:
: tempCadena有指向目录的值:D: ' ShamTec MySQL '文件夹名称中有一个空格这就是进程返回错误
的原因。谢谢