PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

System.BadImageFormatException
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1674
Page 1 of 1

Author:  RodPrice [ Mon May 30, 2011 10:43 am ]
Post subject:  System.BadImageFormatException

I wrote an app that produces a fairly complex PDF with lines, pictures etc. It works fine in my browser under the VB2008 built in web server. ... no problem but I don't want it local, it must run from a website.

When I publish the app I get this error.

System.BadImageFormatException: Could not load file or assembly 'PdfSharp, Version=1.31.1789.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb' or one of its dependencies. The module was expected to contain an assembly manifest.

I have created the simplest website, one page, one button with the code from your "hello " application verbatim.
I still get this error. Looks like perhaps the pdfsharp.dll is not correct? It is in the right place because if I remove it I get a different error.

Is there an "Idiots guide to getting PDF sharp to work" somewhere that I can read... I'm missing something basic possibly?

Can anyone help?

Author:  Thomas Hoevel [ Mon May 30, 2011 1:34 pm ]
Post subject:  Re: System.BadImageFormatException

We have our websample:
http://www.pdfsharp.net/wiki/Clock-sample.ashx

We managed to get it running on IIS under Windows Server.
We don't have a step by step guide - this guide would need to be rewritten with every new version of IIS anyway.

Which Windows version? Which IIS?
Did you create an Application for your site?
Which Application Pool do you use?
Did you install/register .NET with IIS? Did you select the correct .NET version?

Could be a problem of 32 bit vs. 64 bit:
http://www.developmentalmadness.com/arc ... ption.aspx
http://www.davidmoore.info/2008/10/14/s ... exception/

Author:  RodPrice [ Mon May 30, 2011 3:08 pm ]
Post subject:  Re: System.BadImageFormatException

Yes I did build an application for the site
I'm on Windows 7 32bit.
IIs or something similar is installed on some webserver at an ISP somewhere in the world ...I have no control over it or whats installed there. The rest of of my website on SQL Server works 100% .. I just need to be able to print something.

If have tried rebuilding the DLL for X86 only .. didn't change anything.
I put the DLL in the GAC
I put the DLL in the webroot\bin directory

The installer info I was after ( idiots guide...) are

Do I have to have any special settings in my web.config
do I have to alter anything in Assemblyinfo.vb

The program works so well locally but I have now been poking around for 3 days and have got absolutely nowhere yet on the website side... i'm going to have to try another product.

Author:  Thomas Hoevel [ Tue May 31, 2011 7:25 am ]
Post subject:  Re: System.BadImageFormatException

RodPrice wrote:
Do I have to have any special settings in my web.config
do I have to alter anything in Assemblyinfo.vb

None I know of.
We have full control over our IIS and we fiddle with Application and AppPool settings until it runs.

Recently 64 bit vs. 32 bit made things more complicated. The IIS of your ISP could be running 64 bit Windows.

Not my area of expertise. Rather a question for IIS experts than for PDFsharp experts.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/