【发布时间】:2021-08-14 21:02:33
【问题描述】:
尊敬的 Stack Overflow 社区,
我正在尝试使用 C# 与 Ngrok 控制台进行通信。不幸的是,“StartInfo.Arguments”不起作用。比如我在c#代码中写"StartInfo.Arguments=" ngrok",不会出现ngrok帮助文本,但是日志中会出现"ERROR: Unrecognized command: ngrok"。但是如果我自己打开控制台,写上“ngrok”就可以了。
private void startServer()
Process compiler = new Process();
compiler.StartInfo.FileName = "ngrok.exe";
compiler.StartInfo.Arguments = "\"ngrok\"";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
Console.WriteLine(compiler.StandardOutput.ReadToEnd());
compiler.WaitForExit();
}
【问题讨论】:
标签: c# .net process console ngrok