-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BadImageFormatException #18
Comments
@redserpent7 Had the same Problem, are you using 64 bit architecture? I had to copy the gsdll64.dll from my GhostScript installation folder and copy it to the Release folder of my Project and rename it to gsdll32.dll. It worked fine from that point on. I guess that Ghostscriptsharp is not realy supporting 64 bit architecture because the gsdll64.dll is missing in the nuget package. |
Nice work around that does the trick! |
To MichaelAlt: You saved my bacon man! I would never have figured out that renaming a dll would fix the issues. Thanks. |
@MichaelAlt, thank you. Solved our problem as well. |
I used dotPeek to see what is going on, because there was a merge request to support 64 bit that should work. The published nuget package 1.3.1.4 only looks for gsdll32.dll and calls its methods. So basically the latest nuget package (from 6/2/2014) doesn't contain it the support for 64bit that was supplied in a PR and merged in f4fa63b (Oct 15, 2013). Instead, it uses some other obsolete version of the project. WTF? Anyway, thanks @MichaelAlt, your help is appreciated many years later. |
@MichaelAlt, thank you. Solved my problem as well - This is a Brilliant for any Future issues regarding 32 bit & 64 Bit |
Just for fyi, ghostscriptsharp has been used for several years on a shared host. Moved to a VPS and got the BadImageFormatException. I have tried
So far, nothing works. Later on tonight, I will stop and start the website and see if that does anything, as it looks like just changing the app pool to allow 32 bit dlls should have fixed it. My local pc is Windows 10, x64 and it works fine locally, out of Visual Studio. The new VPS is Windows Server 2019 x64. Very frustrating. I actually tested a lot of stuff before moving to the new server, but I missed this issue. -=-=-= Update. After stopping and restarting the website in IIS, PDF thumbnails are working again. I'm going to assume the fix was setting the app pool to allow 32 bit to run, because I have the 32 bit versions of ghostscriptsharp and ghostscript.dll on the VPS and they are working. So, IIS > application pool > {website} and right click > Advanced Settings > Enable 32-bit Applications = True. Recycle the app pool AND stop and start the website. -=-=-= Update. The VPS had a similar site with an almost identical structure. I was able to confirm that just setting the IIS application pool to allow 32 bit applications and recycling the app pool/stop starting the website will make everything go back to work. Stopping and starting the website seems to be a big factor in this, so don't skip it. Of course, not everyone has access to IIS to do that. It would be nice if the 64 bit versions would actually work. |
Hi,
I downloaded ghostscriptsharp from NuGet and whenever I call: GhostscriptWrapper.GenerateOutput(pdfPath, pagePath, settings);
It gives me a BadImageFormatException "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"
I tried building my project with AnyCPU, 32 and 64 bit architecture but always getting the same exception.
The text was updated successfully, but these errors were encountered: