问题描述
我正在尝试从Azure IoT Edge中的一个模块开始一个过程,但是我得到了:
System.ComponentModel.Win32Exception (2): No such file or directory
我模块中的代码
var startInfo = new ProcessStartInfo
{
FileName = "dotnet --info",UseShellExecute = true,RedirectStandardOutput = false,RedirectStandardError = false,CreateNoWindow = true
};
Process.Start(startInfo);
我想-由于IoT Edge模块在docker容器中运行-我没有运行Process.Start()的权限,但是我不知道如何获得对模块的这种访问权限。
解决方法
您是否要在容器内启动该过程?还是在主机上?如果在容器内,您是否在其中安装了dotnet core(或确认已安装)?
如果是这样,并且假设这是Windows容器,您是否可以通过在命令提示符处“闯入”正在运行的容器来尝试从命令行中手动运行命令?
docker -H npipe:////../pipe/iotedge_moby_engine exec -it cmd
这应该在容器内给您一个命令提示符。.您可以在此处尝试使用'dotnet --info',看看会发生什么情况