意外进程。Azure WorkerRole中的启动行为

意外进程。Azure WorkerRole中的启动行为,azure,Azure,我有一些奇怪的行为 基本上,我的代码在本地计算机上运行良好,当我使用远程桌面登录到该服务时,我可以使用与C#中给出的参数完全相同的参数从命令行运行exe。它工作得很好 我想知道的是,是否有任何限制或权限阻止exe在Azure WorkerRole中运行?或者可能代码中有什么错误阻止它在WorkerRole中正常运行,但只在Azure上运行 exe不会重定向任何stdout或stderr,因此当出现错误时,我无法读取任何输出。这也发生在我的本地计算机上 exe设置为复制到azure上应用程序的生

我有一些奇怪的行为

基本上,我的代码在本地计算机上运行良好,当我使用远程桌面登录到该服务时,我可以使用与C#中给出的参数完全相同的参数从命令行运行exe。它工作得很好

我想知道的是,是否有任何限制或权限阻止exe在Azure WorkerRole中运行?或者可能代码中有什么错误阻止它在WorkerRole中正常运行,但只在Azure上运行

  • exe不会重定向任何stdout或stderr,因此当出现错误时,我无法读取任何输出。这也发生在我的本地计算机上
  • exe设置为复制到azure上应用程序的生成目录。exe存在于指定的路径(我已经尝试了File.exists,以及pdf所在的位置,只是为了确保)
  • 我已尝试将
    startInfo.CreateNoWindow
    设置为
    true
    以查看是否可以查看在远程桌面上运行的进程,但我无法查看。我假设WorkerRole和远程桌面是机器上的不同用户
这是我的密码:

LocalResource tempStorage = RoleEnvironment.GetLocalResource("TempStorage");
string tempDir = tempStorage.RootPath;
string tempName = Guid.NewGuid().ToString();
string tempFile = Path.Combine(tempDir, tempName + ".pdf");
string saveFile = tempName + ".html";
string exeDir = Path.Combine(Environment.GetEnvironmentVariable("RoleRoot") + @"\", @"approot\Resources\");
File.WriteAllBytes(tempFile, fileBytes);

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Path.Combine(exeDir, "pdf2htmlEX.exe");
startInfo.UseShellExecute = false;
startInfo.WorkingDirectory = exeDir;
//startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = String.Format("--zoom 1.5 --dest-dir \"{0}\" \"{1}\" \"{2}\"", tempDir, tempFile, saveFile);
startInfo.CreateNoWindow = true;

using (Process proc = Process.Start(startInfo))
{
    proc.WaitForExit(30000);
}
// saveFile does not exist here or any time after the process exists
使用此项目的exe。太棒了:

编辑:找到一些日志信息

Faulting application name: pdf2htmlEX.exe, version: 0.0.0.0, time stamp: 0x520bb881
Faulting module name: pdf2htmlEX.exe, version: 0.0.0.0, time stamp: 0x520bb881
Exception code: 0xc0000005
Fault offset: 0x0013a6e4
Faulting process id: 0x9cc
Faulting application start time: 0x01ceaf4109e78f34
Faulting application path: C:\Resources\directory\96bf7ddee08d45a8883fe2a603131842.WorkerRole.TempStorage\pdf2htmlEX.exe
Faulting module path: C:\Resources\directory\96bf7ddee08d45a8883fe2a603131842.WorkerRole.TempStorage\pdf2htmlEX.exe
Report Id: 48260a60-1b34-11e3-93ef-00155d4334a7
Faulting package full name: 
Faulting package-relative application ID: 
该过程在预处理所有页面后停止,然后在工作时失败。如果我运行“DebugView”,我会得到:


也许这是应用程序的一个bug?(可能不应该写入内存)我仍然不明白为什么这只会在WorkerRole中失败。

我会推荐几种不同的方法来解决这个问题

  • 普罗克蒙。它会告诉你,如果你试图在某个地方写临时文件时被拒绝访问
  • 将WinDBG连接到pdf2htmlEX.exe,查看它是否引发任何异常

  • #2的诀窍是将WinDBG连接到Azure中运行的进程,这很棘手。有关在Azure VM上获取Procmon和WinDBG的快速简便方法,以及将WinDBG附加到进程的方法,请参阅。

    您查看了日志吗?是的,我查看了,但没有任何内容。所以我要失明了。我刚刚学到了这一点,但我想可能是因为这个过程。它可能正在将这些文件写入工作目录(这可能是不允许的)。今晚我将做一个测试,看看是否是这样(通过将exe复制到本地资源)。如果是这样的话,我会更新这个问题,以反映我找到的答案,从而使它对其他人更普遍。
    [1356] Invalid parameter passed to C runtime function.
    [1356] Error - 
    [1356] RtlWerpReportException failed with status code :-1073283067. Will try to launch the process directly
    [1356]