该程序在Windows上运行良好。我在Windows上以.Net核心模式发布了它。但我在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“和headless-mode,并在ubuntu上以根用户的身份运行程序。因此,dotnet是否拥有所有的root特权?所有的库都是最新版本。我已经在互联网上搜索过了,但没有找到任何解决方案。
发布于 2019-11-05 17:36:03
我解决了这个问题。我的工作目录是/root/ServerLinux,我写了这个命令:sudo chmod -R 777 ServerLinux at /root。一切正常!
https://stackoverflow.com/questions/58698095
复制相似问题