HakanL / WkHtmlToPdf-DotNet

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
GNU Lesser General Public License v3.0
378 stars 67 forks source link

Not working on Azure Web App 32 bits #125

Closed POFerro closed 7 months ago

POFerro commented 7 months ago

Hi :),

I'm trying to use the library in an Azure Web App running 32 bit ( mandatory for free and basic app pricing tier ) and it doesn't work, simply blows the process not even giving any error output. I tried on a 64 bit infrastructure ( increasing the pricing plan ) and it works fine, so it must be the architecture difference.

The challenge I see is that it is built for Any CPU and so the decision to load the native library should be taken in runtime rather than compile time, that might be the issue. Can you help me? Am I missing something?

Thanks in advance and best regards POFerro

HakanL commented 7 months ago

It should support 32-bit as we have winx86 runtimes. Maybe try it out locally as 32-bit app first and go from there? It could also be that the lower levels of Azure don't allow the loading of native runtimes.

POFerro commented 7 months ago

Hi @HakanL , I'm going to try replicate the test on my machine, will let you know of the result. Regarding the lower levels of Azure I don't think that should be a problem since It's running Ok with the 64 bit version

HakanL commented 7 months ago

But you said you had to increase the pricing plan to run 64-bit.

POFerro commented 7 months ago

Yes, that was my workaround, but I don't believe it changes any "lower levels of Azure" requirements, it just changes the architecture from x86 to x64. What I think might be happening in Azure is that it is more restrict on process architecture and when a module is loaded with incorrect format it doesn't throw a nice Exception, just blows the process. That's why I propose you the previous PR to change a little the way we are deciding which native module to load.

Can you give it a try and tell me what you think?

Thanks and best regards POFerro

HakanL commented 7 months ago

That may be the case, haven't tested those scenarios, but your PR looks good so I'll roll it in and see if you can do some more testing with the nuget package.

HakanL commented 7 months ago

@POFerro I tried the newly built .88 nuget package in my Azure-hosted solution (64-bit) and it worked fine. Please report back if the new nuget package is working for you with the lower level Azure instances.

POFerro commented 7 months ago

Hi @HakanL ,

It's running Ok on a basic instance x86 but unfortunately it still doesn't work on Free tier or any shared Azure instance pricing model :(. Looks like you where right the blockage is on loading this specific native module, the Azure sandbox used in these Shared environments doesn't allow the operations that wkhtmltopdf is doing, for what I've seen here .

Basically my original problem is unsolvable :(. Thanks anyway best regards and congrats for the lib, it's great ;)