fpanaccia / Wkhtmltopdf.NetCore-deprecated

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

Got error on linux #5

Closed iJzFan closed 5 years ago

iJzFan commented 5 years ago

I try this example https://github.com/fpanaccia/Wkhtmltopdf.NetCore.Example with docker run on linux and got below error.

Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HLOHJ6AVNDMN", Request id "0HLOHJ6AVNDMN:00000001": An unhandled exception was thrown by the application. System.ComponentModel.Win32Exception (2): No such file or directory at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html) at WebApplication1.Controllers.ValuesController.Get() in C:\Users\quxianyang\source\repos\ConsoleApp4\WebApplication1\Controllers\ValuesController.cs:line 38 at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at System.Threading.Tasks.ValueTask1.get_Result() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)

fpanaccia commented 5 years ago

Hi, you tried the last version? and also, you didn't run docker-compose, you just do "docker run" with the dockerfile, right?

iJzFan commented 5 years ago

Hi, you tried the last version? and also, you didn't run docker-compose, you just do "docker run" with the dockerfile, right?

yes,latest version and only use docker run

fpanaccia commented 5 years ago

for been able to reproduce, what distro and version of linux are you using, and what version of docker are you running?

also, if you run the compose, did you run with same issue?

iJzFan commented 5 years ago

Here is my dockerfile.

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 RUN apk add libgdiplus libc6-dev --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted WORKDIR /app COPY ./publish/ ./ RUN ["chmod", "755"] ENTRYPOINT ["dotnet", "WebApplication1.dll"]

fpanaccia commented 5 years ago

Hi, i was unable to reproduce the error, could you please upload your solution "WebApplication1" somewhere?¿

iJzFan commented 5 years ago

I found the reason, it works fine on default linux docker images,but not work on alpine.

shorabh-jain-sumati commented 4 years ago

Hi, did it eventually work on a docker container with Alpine linux? I am getting the following exception on Alpine linux

System.IO.IOException: Broken pipe          at System.IO.FileStream.WriteNative(ReadOnlySpan1 source)          at System.IO.FileStream.WriteSpan(ReadOnlySpan1 source)          at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)          at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)          at System.IO.StreamWriter.WriteLine(String value)          at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html)          at Wkhtmltopdf.NetCore.GeneratePdf.GetPDF(String html)

Any help here would be appreciated