2

I have created web service that uses some external dll. Evrything works fine when I run web service on IIS Express from VS IDE. Web service call dll functions without problems. But when I publish this web service to local computer IIS and call method that exposes dll function I got error:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

According information I found on internet it might bee 64/32 bit compatibility issue. My dll is compiled like 32 bit app.

How to fix this problem?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
vico
  • 17,051
  • 45
  • 159
  • 315
  • Did you take a look at [this SO question](http://stackoverflow.com/questions/6728339/iis-7-5-fixing-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-pr)? Might have some useful info. – Jason Evans Nov 06 '15 at 13:12

1 Answers1

2

In IIS go to the Application Pools.

Select the Application Pool of your web service then click on "Advanced Settings".

Look for the option "Enable 32-Bit Applications" and set it to true.

Then restart IIS and try again.

I had a similar problem and I solved in this way

Roberto Mattea
  • 335
  • 2
  • 10