存在存在ExitCode 255的进程 [英] Process exists with ExitCode 255
问题描述
[IIS 7.5/Windows 7/Visual Studio 2012]
[IIS 7.5 / Windows 7 / Visual Studio 2012]
我试图让我的MVC应用程序运行位于同一台计算机上的外部命令行工具.
I am trying to have my MVC app run an external command line tool located on the same machine.
我将IIS_USRS的执行权限授予了包含该工具的整个文件夹.
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);
没有例外(路径正确),但是该过程立即存在,退出代码为255
No exceptions (path is right), but the process exists rightaway with ExitCode 255
我可以手动执行该过程.
I can execute the process manually.
可能是什么原因?
推荐答案
退出代码255听起来像您正在运行的工具(目标应用程序)中的.NET异常.您将无法在代码中捕获此异常.
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:
-
转到
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Image文件执行选项
使用您要启动的可执行文件的名称创建一个密钥
Create a key with the name of the executable you're starting
创建一个名为 Debugger
为其提供一个值,例如 vsjitdebugger.exe
(如果它是.NET应用程序)
Give it a value, e.g. vsjitdebugger.exe
if it's a .NET application
这将启动调试器,您可以捕获异常.
This will start the debugger and you can catch exceptions.
这篇关于存在存在ExitCode 255的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!