Mertez
Mertez

Reputation: 1131

Headless Google Chrome Doesn't Fire in Windows Server 2016 via ASP.NET Core 2.2

I am trying to generate PDF using Google Chrome Headless, using this code in ASP.NET Core 2.2:

        string args = $"--headless --disable-gpu --print-to-pdf={targetFile} {file}";
        string chrome = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";

        ProcessStartInfo inkscapeInfo = new ProcessStartInfo(chrome, args);
        Process inkscape = Process.Start(inkscapeInfo);
        inkscape.WaitForExit(5000);

It works great in my local computer and Visual Studio but when I upload it to the Windows 2016 Server It does't work, I checked the chrome.exe path and it was correct on the server. Actually I tried some other possible solutions but it seem no exe file fires not only headless chrome, what should I do?

Upvotes: 1

Views: 476

Answers (1)

Mertez
Mertez

Reputation: 1131

Finally I found a solution!

  1. I added the IUser_DomainName user to administrative group.
  2. I added this user to the chrome.exe and give it a full permission.

None of them worked alone!

Upvotes: 1

Related Questions