Screenshot in Windows Service
See original GitHub issueDescription
Taking a screenshot of a page only works while debugging inside Visual Studio, if I build my windows service I get stuck on this method.
Complete minimal example reproducing the issue
public async System.Threading.Tasks.Task Async(string url, string outPath)
{
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true
});
var page = await browser.NewPageAsync();
await page.GoToAsync(url);
await page.SetViewportAsync(new ViewPortOptions
{
Width = 1366,
Height = 768
});
await page.ScreenshotAsync(outPath);//The process hangs here
await page.CloseAsync();
await browser.CloseAsync();
}
Expected behavior:
I can take the screenshot
Actual behavior:
The process hangs in the ScreenshotAsync method
Versions
- Puppeteer-Sharp v 1.13.0, I know 1.14.0 is out but I can’t update because I get this when trying to update: “Severity Code Description Project File Line Suppression State Error Failed to add reference. The package ‘Mono.Posix.NETStandard’ tried to add a framework reference to ‘Mono.Posix’ which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance. Error HRESULT E_FAIL has been returned from a call to a COM component.”
- Targeting .NET Framework 4.7.2
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Windows Service for taking screenshots - dotnetspider.com
Steps : Go to Run -> Type Services.msc -> Find your service in the list of all the installed services -> Right click...
Read more >c# - Screen capture using windows service
I'm creating windows service to capture screen(windows 7). ( i tried this using windows application and it works properly. ).
Read more >Screen capture in windows desktop service
If you google "c# take screenshot windows service" you'll find various articles and examples from other people who have tried this kind of ......
Read more >8 Easy Ways to Take Screenshots in Windows 10 and 11
Alt + Print Screen To take a quick screenshot of the active window, use the keyboard shortcut Alt + PrtScn. This will snap...
Read more >[C# Windows Service] Automatic Screen Capture
Open visual studio (I'm using VS2012), and then create new project. Select windows service template project, see picture above. Normally, you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AzeExMachina I downgrade to 1.11 and it works now. Thanks a lot 😃
its about how to break session0 in windowsService