Wkhtmltopdf.NetCore-deprecated icon indicating copy to clipboard operation
Wkhtmltopdf.NetCore-deprecated copied to clipboard

Win32Exception: Permission denied on Azure

Open adriantheking opened this issue 3 years ago • 9 comments

Good morning, I'm trying to launch library on Azure WebApp. Unfortunately all the time I have an error:

System.ComponentModel.Win32Exception (13): Permission denied at Wkhtmltopdf.NetCore.GeneratePdf.GetByteArray[T](String View, T model)

For test purpose I injected also IRazorViewToStringRenderer class from the library to check is HTML rendered properly await this.razorViewToStringRenderer.RenderViewToStringAsync("Views/Home/Index.cshtml", results); At this moment everything working good, method is returning rendered HTML.

Problem is starting when I try to call await generatePdf.GetByteArray("Views/Home/Index.cshtml", results);

About environment: Everything is deployed by Azure Pipelines for sure I'm giving there 755 chmod for Linux/wkhtmltopdf and Windows/wkhtmltopdf.exe files. WebApp is launched on App Service Plan S1 with Linux environment

adriantheking avatar Sep 16 '20 10:09 adriantheking

Hi! Locally in your pc is running fine? what version of the library are you running?

fpanaccia avatar Sep 16 '20 17:09 fpanaccia

Yes, locally everything works perfect, latest version from this repo

adriantheking avatar Sep 16 '20 17:09 adriantheking

Hi @fpanaccia, Any updates in this area ?

adriantheking avatar Sep 22 '20 08:09 adriantheking

@fpanaccia I have the same problem

jlfjunior avatar Oct 07 '20 18:10 jlfjunior

@fpanaccia Any news about this?

lndr-ssantos avatar Oct 30 '20 13:10 lndr-ssantos

I had the same problem, but making wkhtmltopdf executable helped me. I wrote in console: chmod +x /path_to_app/Rotative/Linux/wkhtmltopdf Maybe it will help someone. @adriantheking are you really sure Azure Pipelines gives 755 chmod for wkhtmltopdf?

lookinsidethebox avatar Feb 18 '21 14:02 lookinsidethebox

@lookinsidethebox Yes I double checked it. How you running your application ?

adriantheking avatar Feb 19 '21 10:02 adriantheking

@adriantheking I publish the application with MS Visual Studio in a local folder, manually copy files from the folder to my server (Alt Linux 8.2) and restart the application with supervisor.

Have you tried asking Azure Support? Maybe you need special permissions to run scripts on your server.

lookinsidethebox avatar Feb 19 '21 11:02 lookinsidethebox

This error is expected on azure since azure doesn't let you execute .exe files on the app service.

There is no way to fix this unless you run your own app inside your own VPS or this library changes to use .dll directly (which lead in a total source code refactor) instead of executing the .exe.

arivera12 avatar Jun 15 '21 21:06 arivera12