Rotativa.AspNetCore icon indicating copy to clipboard operation
Rotativa.AspNetCore copied to clipboard

Win32Exception: The specified executable is not a valid application for this OS platform.

Open ahmadsharjeel opened this issue 7 years ago • 4 comments

Got Win32Exception while creating pdf from aspnet core mvc application. I am targeting .Net core 2.1 framework on Win 10 64 bit OS. Following is the stacktrace from exception.

System.Diagnostics.Process.StartWithCreateProcess(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.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

ahmadsharjeel avatar Aug 27 '18 13:08 ahmadsharjeel

Do you have wkhtmltopdf executable in your project under /wwwroot/Rotativa/wkhtmltopdf.exe, and have you configured Rotativa in Startup.cs?

MathieuAuclair avatar Feb 11 '19 22:02 MathieuAuclair

Having exactly the same issue on Windows 10 Pro, 64 bit. Everything is set well but I get exactly the error above using .Net Core 2.0

Please were you able to solve this? How?

coommark avatar Jan 20 '20 11:01 coommark

I found the solution. Simply download the repo, compile on your machine and then copy the wkhtmltopdf.exe from the sample project and use.

coommark avatar Jan 23 '20 07:01 coommark

I found the solution. Simply download the repo, compile on your machine and then copy the wkhtmltopdf.exe from the sample project and use.

This worked for me. Pretty random. Thank you for suggesting this!

BadDub avatar Sep 27 '23 15:09 BadDub