Process exists with ExitCode 255

旧时模样 提交于 2021-01-27 05:34:45

问题


[IIS 7.5 / Windows 7 / Visual Studio 2012]

I am trying to have my MVC app run an external command line tool located on the same machine.

I gave execute permissions to IIS_USRS to the whole folder that contains the tool.

I invoke it with:

ProcessStartInfo startInfo = new ProcessStartInfo();  
startInfo.WindowStyle = ProcessWindowStyle.Normal;  
startInfo.FileName = myPath;  
startInfo.Arguments = myArguments;  
PartialRunProcess = Process.Start(startInfo);  

No exceptions (path is right), but the process exists rightaway with ExitCode 255

I can execute the process manually.

What could be the cause ?


回答1:


Exit code 255 sounds like a .NET exception within the tool (target application) you're running. You'll not be able to catch this exception in your code.

I would register a debugger for the target application to see what exception it throws:

  1. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

  2. Create a key with the name of the executable you're starting

  3. Create a string called Debugger

  4. Give it a value, e.g. vsjitdebugger.exe if it's a .NET application

This will start the debugger and you can catch exceptions.



来源:https://stackoverflow.com/questions/23789351/process-exists-with-exitcode-255

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!