该程序在 Windows 上运行良好。我在 Windows 上以 .Net Core 模式发布了它。但是我在 Ubuntu 上得到了这个错误:
Unhandled exception. System.ComponentModel.Win32Exception (13): Permission denied
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at PuppeteerSharp.ChromiumProcess.State.StartingState.StartCoreAsync(ChromiumProcess p)
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)
at WebScraping.Authorization.GetCookieByAuthorizationAsync(String[] args, String pathToCookieFile) in C:\Users\Serega\Desktop\dz4all\Homework\WebScraping\Authorization.cs:line 22
at WebScraping.Program.Main(String[] args) in C:\Users\Serega\Desktop\dz4all\Homework\WebScraping\Program.cs:line 41
at WebScraping.Program.<Main>(String[] args)
我可以假设 Visual Studio 已经发布了仅适用于 Windows 系统的项目。我的 Ubuntu 只是终端。我在 PuppeteerSharp 的启动设置中设置了“--no-sandbox”和无头模式,并在 ubuntu 上以 root 用户运行程序。因此,dotnet 是否具有所有 root 权限?所有库都是最新版本。我在互联网上搜索过,但找不到任何解决方案。