Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working under Windows Service #2582

Open
TejasPatadiya10 opened this issue Apr 3, 2024 · 0 comments
Open

Not working under Windows Service #2582

TejasPatadiya10 opened this issue Apr 3, 2024 · 0 comments

Comments

@TejasPatadiya10
Copy link

If we use puppeteer-sharp with console app its working fine

but when we use it with Windows Service we are getting below exception with LaunchAsync

System.AggregateException: One or more errors occurred. (Failed to create connection)
---> PuppeteerSharp.ProcessException: Failed to create connection
---> PuppeteerSharp.TargetClosedException: Protocol error(Target.setDiscoverTargets): Target closed. (The remote party closed the WebSocket connection without completing the close handshake.)
at PuppeteerSharp.Helpers.TaskHelper.WithTimeout[T](Task1 task, TimeSpan timeout, Func2 exceptionFactory) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Helpers/TaskHelper.cs:line 183
at PuppeteerSharp.Connection.SendAsync(String method, Object args, Boolean waitForCallback, CommandOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Connection.cs:line 138
at PuppeteerSharp.ChromeTargetManager.InitializeAsync() in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/ChromeTargetManager.cs:line 61
at PuppeteerSharp.Browser.CreateAsync(SupportedBrowser browserToCreate, Connection connection, String[] contextIds, Boolean ignoreHTTPSErrors, ViewPortOptions defaultViewPort, LauncherBase launcher, Func2 targetFilter, Func2 isPageTargetCallback, Action1 initAction) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Browser.cs:line 304 at PuppeteerSharp.Browser.CreateAsync(SupportedBrowser browserToCreate, Connection connection, String[] contextIds, Boolean ignoreHTTPSErrors, ViewPortOptions defaultViewPort, LauncherBase launcher, Func2 targetFilter, Func2 isPageTargetCallback, Action1 initAction) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Browser.cs:line 309
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 74
--- End of inner exception stack trace ---
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 92
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 98

We have make sure that we are using it with proper awaits as its working fine with console app,

Besides this if we are using --no-sandbox then its working fine with windows service. but we read the documentation and came to know that using this args is not recommended.

so please suggest any other way to run it under windows service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants