Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Win32Exception: Permission denied on Azure #36

Open
adriantheking opened this issue Sep 16, 2020 · 9 comments
Open

Win32Exception: Permission denied on Azure #36

adriantheking opened this issue Sep 16, 2020 · 9 comments

Comments

@adriantheking
Copy link

adriantheking commented Sep 16, 2020

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
Copy link
Owner

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

@adriantheking
Copy link
Author

adriantheking commented Sep 16, 2020

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

@adriantheking
Copy link
Author

Hi @fpanaccia,
Any updates in this area ?

@jlfjunior
Copy link

@fpanaccia I have the same problem

@lndr-ssantos
Copy link

@fpanaccia Any news about this?

@lookinsidethebox
Copy link

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
Copy link
Author

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

@lookinsidethebox
Copy link

@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
Copy link

arivera12 commented Jun 15, 2021

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.

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

No branches or pull requests

6 participants