在TeamCity代理上运行Azure Compute Emulator

在TeamCity代理上运行Azure Compute Emulator,azure,teamcity,xunit,Azure,Teamcity,Xunit,我在TeamCity代理上运行compute emulator时遇到了一个问题,这是与xunit进行集成测试的CI过程的一部分。 我正在使用以下代码启动仿真器,并在执行Xunit测试时部署实例 ExecuteCsrunWith(serviceDirectory + " " + configurationFile); private ProcessExecutionResult ExecuteCsrunWith(string argument) { var

我在TeamCity代理上运行compute emulator时遇到了一个问题,这是与xunit进行集成测试的CI过程的一部分。 我正在使用以下代码启动仿真器,并在执行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.InvalidOperationException 堆栈: 在System.Windows.Forms.MessageBox.ShowCoreSystem.Windows.Forms.Iwin32窗口中,System.String,System.String,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon,System.Windows.Forms.MessageBoxDefaultButton,System.Windows.Forms.MessageBoxOptions,布尔值 位于System.Windows.Forms.MessageBox.ShowSystem.String、System.String、System.Windows.Forms.MessageBox按钮、System.Windows.Forms.MessageBox图标 位于Microsoft.ServiceHosting.Tools.CloudServicesMonitor.Program.MainSystem.String[]

其次是:

故障应用程序名称:csmonitor.exe,版本:2.4.6489.1,时间戳:0x53bdc3cc 故障模块名称:KERNELBASE.dll,版本:6.2.9200.16864,时间戳:0x531d34d8 异常代码:0xe0434352 故障偏移量:0x0000000000047b8c 出错进程id:0xe98 故障应用程序启动时间:0x01cff4c9c18a8431 出现故障的应用程序路径:C:\Program Files\Microsoft SDK\Azure\Emulator\csmonitor.exe 故障模块路径:C:\Windows\system32\KERNELBASE.dll 报告Id:2321e30b-60bd-11e4-9406-00155dfd9db8 故障包全名: 错误包相对应用程序ID:


我需要使用UseShellExecute=false,因为我需要重定向和读取输出

问题是:Teamcity代理作为本地系统帐户运行。 当csrun.exe进程开始使用本地系统帐户时,compute emulator中似乎存在问题

修复方法:我将Teamcity代理更改为windows服务,开始使用自定义构建主帐户,现在一切正常