fpanaccia / Wkhtmltopdf.NetCore-deprecated

Rotativa + Net Core
The Unlicense
220 stars 94 forks source link

Win32Exception: Permission denied on Azure #36

Open adriantheking opened 4 years ago

adriantheking commented 4 years ago

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

fpanaccia commented 4 years ago

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

adriantheking commented 4 years ago

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

adriantheking commented 4 years ago

Hi @fpanaccia, Any updates in this area ?

jlfjunior commented 4 years ago

@fpanaccia I have the same problem

lndr-ssantos commented 3 years ago

@fpanaccia Any news about this?

lookinsidethebox commented 3 years ago

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?

adriantheking commented 3 years ago

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

lookinsidethebox commented 3 years ago

@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.

arivera12 commented 3 years ago

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.