I have refered a 64-bit com interop dll in a c# class library project and have the code to initialize it, this library is used in a asp.net project.
Since the business layer project and asp.net is in c# i have configured to be for Any CPU platform. Also i have set the
Now when i try to initialize the com class in my business layer project i get below error. Any advice what this error for and why does it mention as not valid Win32 application as i have covered it to 64 bit.
Creating an instance of the COM component with CLSID {31DE5D69-1F5F-434D-8855-F627EAEB2404} from the IClassFactory failed due to the following error: 800700c1 is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).
Thanks
It is not possible to reference x64 COM libraries from x86 processes. If you set your configuration to "Any CPU" the word length get's terminated during the initialisation of your application, meaning that if you are launching your application on x86 systems would result in using the x86 configuration, that cannot reference x64 libraries.
You need to create a x64 library in order to use x64 based COM servers. In your IIS configuration the Application Pool also needs to use x64. However you should avoid using "Any CPU" for your projects, refering to this article.
I Had to register the dll in a 64-bit command prompt of visual studio 2012, This registered the dll properly as 64-bit and i was able to use it in c# project.
User contributions licensed under CC BY-SA 3.0