Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 13, 2011 09:34 AM by mkonanki
Oct 11, 2011 07:07 PM|LINK
When i tried to load c++ library(dll) from asp.net 3.5 getting below error
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
but when i run my project from visual studio(by pressing F5) i could run dll without any error.
When i run my project from IIS its throwing above error.
What could be the problem?
EntryPoint = "GetXML", SetLastError =
false, CharSet =
myString, int length,
DLLPath = "C:\\Inetpub\\wwwroot\\test\\bin\\myAPI.dll";//
lib = LoadLibrary(DLLPath); //
resultxml = string.Empty;
str = new
GetXML(str, str.Capacity, 250);
myString = str.ToString();
Oct 13, 2011 09:14 AM|LINK
This error indicates that you are trying to load a 32 bit dll into a 64 bit process.
The both post below have disccussed a this issue, please check:
Oct 13, 2011 09:26 AM|LINK
Try to re-Compiling and re-run all script code this is due an attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) if this is still encountered then try to set or enable to 32 bit.
Because my web service application was using an older 32-bit driver, and or you can try using IIS7 to run in 32-bit mode and this is how I did it.
Under IIS7, my web application was running in an application pool.
Right clicked over the AppPool name
1.Selected Advanced Settings...
2.Under the General Section, set Enable 32-Bits Application to True
3.Click OK, you may want to recycle the application pool just to be sure.
Oct 13, 2011 09:34 AM|LINK
HRESULT show that this is most likely a 64bit vs 32bit issue.
1. check the dll is which bit
2.The other option is to change your application pool for the website to use 64bit. (I believe 32-bit is default).
check below thread for iis7 configure 32-bit