我在TeamCity代理上运行计算仿真器时遇到了问题,因为它是CI过程的一部分,与xunit进行集成测试。在执行Xunit测试时,我使用以下代码启动模拟器并部署实例。
ExecuteCsrunWith(serviceDirectory + " " + configurationFile);
private ProcessExecutionResult ExecuteCsrunWith(string argument)
{
var result = new ProcessExecutionResult();
using (var process = new Process())
{
process.StartInfo = new ProcessStartInfo(PathToCsrun, argument)
{
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
process.Start();
result.Output = process.StandardOutput.ReadToEnd();
result.Error = process.StandardError.ReadToEnd();
process.WaitForExit();
Log(result.Output);
Log(result.Error);
}
return result;
}测试不起作用,我在事件日志中出现了这个错误:
应用程序: csmonitor.exe框架版本: v4.0.30319描述:进程由于一个未处理的异常而终止。异常信息: System.Windows.Forms.MessageBox.ShowCore(System.Windows.Forms.IWin32Window,System.String,System.String,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon,System.Windows.Forms.MessageBoxDefaultButton,System.Windows.Forms.MessageBoxOptions,布尔)Microsoft.ServiceHosting.Tools.CloudServicesMonitor.Program.Main(System.String[]) ( System.Windows.Forms.MessageBoxIcon)
其次是:
故障应用程序名: csmonitor.exe,版本: 2.4.6489.1,时间戳: 0x53bdc3cc故障模块名称: KERNELBASE.dll,版本: 6.2.9200.16864,时间戳:0xe0434d8异常代码: 0xe0434352故障偏移:0x000000000000047b8c故障处理进程Id: 0xe 98故障处理启动时间: 0x01cff4c9c18a8431故障应用程序路径: C:\Program \Microsoft SDKs\Azure\Emulator\csmonitor.exe故障模块路径: C:\Windows\system32\KERNELBASE.dll报告id: 2321e30b-60bd-11e4-9406-db155dfd98故障包全名:故障处理程序包-相关应用程序:
我需要使用UseShellExecute = false,因为我需要重定向和读取输出。
发布于 2014-10-31 23:18:09
问题是: Teamcity Agent作为(本地系统)帐户运行。当csrun.exe进程开始使用(本地系统)帐户时,似乎是计算模拟器中的一个问题。
修复:我更改了Teamcity代理( windows服务),使其开始使用自定义(build )帐户,现在一切都按预期进行。
https://stackoverflow.com/questions/26668159
复制相似问题