我試圖調用一個輔助角色中的可執行文件中調用EXE的Azure的輔助角色
我嘗試了不同的可執行文件:
1-program1.exe (C code compiled with visual studio, target: Win32)
2-program2.exe (C# code, target: x86, this is a dummy program it only creates a text file)
3-program3.exe (C code compiled with visual studio, target: win32, this is a dummy program it only creates a text file)
我的目標是能夠運行program1.exe 。
結果:
1- no signs of success. It should generate some files for any successful run. No files were generated.
2- success. It creates the text file.
3- no signs of success. No file was generated.
所以,我想了解爲什麼program1.exe不工作,但找不到原因。我明白這個問題不是特定於program1.exe的。對於任何win32應用程序,這是有問題的。
這可能是什麼原因?
這裏是一個與調用外部應用程序處理的部分代碼:
var localStorage = RoleEnvironment.GetLocalResource("WorkerLocalStorage");
String workingDir = localStorage.RootPath + @"job";
var appRoot = Path.Combine(Environment.GetEnvironmentVariable("RoleRoot")
+ @"\", @"approot");
String workingDir = localStorage.RootPath + @"job";
String cmdline = "command1 command2";
ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.CreateNoWindow = false;
startinfo.UseShellExecute = true;
startinfo.FileName = Path.Combine(appRoot, @"program1.exe");
//startinfo.FileName = Path.Combine(appRoot, @"program2.exe");
//startinfo.FileName = Path.Combine(appRoot, @"program3.exe");
startinfo.Arguments = cmdline;
startinfo.WorkingDirectory = workingDir;
Process exeProcess = Process.Start(startinfo);
exeProcess.WaitForExit();
program2.exe工作的話,我沒有任何問題與文件上傳到一個blob。我找不到問題。它可能與傳遞命令行參數有關嗎?我需要爲C編碼的可執行文件指定其他內容嗎?
順便說一句,所有的測試都成功在模擬器(即開發環境)
我會嘗試遠程桌面到機器中,看看它在命令窗口中的作用。以下是關於如何遠程連接到計算機的信息的鏈接:http://msdn.microsoft.com/en-us/library/gg443832.aspx – 2011-06-09 11:25:23
嗯,我可以連接到其中一個工作人員。我怎樣才能看到命令窗口?我試過了,什麼也看不見。在模擬器中,它打開命令提示符並運行程序。他們是控制檯應用程序,我應該看到一個命令窗口,對嗎? – 2011-06-09 21:09:41
不要僞造Process Monitor - 你可以將它複製到角色上,然後運行並查看所有缺失的依賴關係。 – sharptooth 2011-06-10 06:03:14