2014-10-31 51 views
0

我在TeamCity代理上運行計算模擬器時遇到問題,作爲與xunit進行集成測試的配置項過程的一部分。 我正在使用以下代碼來啓動模擬器並在執行我的Xunit測試時部署我的實例。在TeamCity代理上運行Azure計算仿真器

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 Framework版本:v4.0.30319 說明:該工藝由於終止的未處理的異常。 異常信息:System.InvalidOperationException Stack: at 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,Boolean) at System.Windows.Forms.MessageBox.Show(System.String,System.String,System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxIcon) 在Microsoft.ServiceHosting.Tools.CloudServicesMonitor.Program.Main(System.String [])

跟:

錯誤的應用程序名:csmonitor.exe,版本:2.4.6489.1,時間戳:0x53bdc3cc 錯誤模塊名稱:KERNELBASE.dll,版本:6.2.9200.16864,時間戳:0x531d34d8 異常代碼:0xe0434352 故障偏移: 0x0000000000047b8c 出錯進程ID:0xe98 錯誤應用程序啓動時間:0x01cff4c9c18a8431 錯誤應用程序路徑:C:\ Program Files文件\微軟的SDK \ Azure的\模擬器\ csmonitor.exe 錯誤模塊路徑:C:\ WINDOWS \ SYSTEM32 \ KERNELBASE.dll 報告ID:2321e30b-60bd-11e4-9406-00155dfd9db8 錯誤包全名: 錯誤包相關應用程序ID:

我需要使用UseShellExecute =假,因爲我需要重定向和讀取輸出。

回答

0

問題是:Teamcity Agent作爲(本地系統)帳戶運行。 當csrun.exe進程開始使用(本地系統)帳戶時,似乎是計算模擬器中的一個問題。

修復:我改變了Teamcity Agent(一個Windows服務)開始使用自定義(構建主)帳戶,現在一切都按預期工作。

相關問題