C# exp.exe命令未完成。它正在进行中
在这段代码中,C# exp.exe命令未完成。它正在进行中,c#,oracle,C#,Oracle,在这段代码中,processExp.WaitForExit(Int32.MaxValue)行不执行,但在此之前文件行工作。如果我使用createdfilename.txt(log)复制或移动文件,则会显示lick error “ISErrorOccurrend System.IO.IOException中出现错误:进程无法访问文件'C:MyBKP\BAK_01_01062017.txt',因为它正被另一个进程使用。”两个问题:1)什么是Apploger?2) 为什么要重定向标准输入?编译器在一个
processExp.WaitForExit(Int32.MaxValue)
行不执行,但在此之前文件行工作。如果我使用createdfilename.txt(log)
复制或移动文件,则会显示lick error
“ISErrorOccurrend System.IO.IOException中出现错误:进程无法访问文件'C:MyBKP\BAK_01_01062017.txt',因为它正被另一个进程使用。”两个问题:1)什么是
Apploger
?2) 为什么要重定向标准输入?编译器在一个记事本文件中显示Apploger消息,以及Apploger.WriteLog(“在WaitForExit之前”);日志是来的,但日志之后是注释,因为processExp.WaitForExit(Int32.MaxValue)未执行。这正在等待完成该过程。
private void RunExportCommand()
{
try
{
appLogger.WriteLog("RunExportCommand Method.");
appLogger.WriteLog("Starting exporting data to dump file.");
using (Process processExp = new Process())
{
string fileName = "exp.exe";
processExp.StartInfo.FileName = fileName;
processExp.StartInfo.Arguments = GetCommandString();
processExp.StartInfo.CreateNoWindow = true;
processExp.StartInfo.UseShellExecute = false;
processExp.StartInfo.RedirectStandardError = true;
processExp.StartInfo.RedirectStandardOutput = false;
processExp.StartInfo.RedirectStandardInput = true;
appLogger.WriteLog("Before Start");
processExp.Start();
appLogger.WriteLog("After Start");
appLogger.WriteLog("Started exporting data to dump file.");
processExp.StandardInput.AutoFlush = true;
processExp.StandardInput.Close();
appLogger.WriteLog("Before WaitForExit");
processExp.WaitForExit(Int32.MaxValue);
appLogger.WriteLog("After WaitForExit");
}
appLogger.WriteLog("Successfully exported data to dump file.");
}
catch (Exception e)
{
appLogger.WriteLog("Exception while exporting data. " + e.ToString());
throw new Exception("Exception while exporting data.", e);
}
}