如何在服务器ubuntu 18.04.3 LTS上启动PuppeteerSharp? System.ComponentModel.Win32Exception(13):权限被拒绝

该程序在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是否具有所有特权? 所有库均为最新版本。 我已经在互联网上进行搜索,但是找不到任何解决方案。

zhengshinanhai 回答:如何在服务器ubuntu 18.04.3 LTS上启动PuppeteerSharp? System.ComponentModel.Win32Exception(13):权限被拒绝

我解决了这个问题。我的工作目录为def request_task(url,data,headers): try: re = requests.post(url,json=data,headers=headers) re.raise_for_status() except requests.exceptions.HTTPError as e: print (e.response.text) 我在/root/ServerLinux处写了该命令:sudo chmod -R 777 ServerLinux。和所有的作品!

本文链接:https://www.f2er.com/3164968.html

大家都在问