I am trying to call the COM library method(COM interopablity) from ASMX webservice hosted in IIS 8.5 & Windows Server 2012 64 bit server. But the call doesnt respond. I have done the following changes to ensure we are doing the right setup
1. Enable 32 bit application = true for application pool setup
2. Registered the COM in the following locations
C:\Windows\System32 & C:\Windows\SysWoW64
3. Tried compile the webservice project to target X86 configuration
4. Changed the execution timeout for web service to 10 mins
5. Did setup application pool identity which worked for my windows application
But none of the above works.
Just to verify .Net and COM communication, I have created the windows
application to call the same method and it works when I compile the
project in X86 platform.
If I compile the windows application to target platform to Any CPU, I
get the same issue like calling it via ASMX web service. Its not
responding to the call.
Finaly, It looks like it is working for windows application target x86
platform. But no idea, why it is not working from asmx service when I
set Enable 32 bit application.
Could you help me to identify what could be the wrong with ASMX to COM call?
Referenced:
Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll)
How to repair COMException error 80040154?
Note: I was getting COM exception 80040154 error when COM was not installed on C:\Windows\System32 folder. Now not getting this error but call not responds.
Server is 64bit
Depending on the COM server you invoke, you may need to specify an Identity for an Application Pool if the COM application requires a user profile, or check the app pool's Load User Profile property. (I needed this to run ABCpdf, for example)
Related
My web API (c# .net 4.7..), hosted on IIS (Windows 10), in order to run properly, requires a piece of software installed on the PC where the IIS is. This piece of software is written in VB and it needs to be running in order for the web-API to start up properly.
The web API is referencing some VB functionality via interop and COM registered dlls.
In Task-manager, i observe that IIS\worker process instead of referencing my running VB6 process, starts a new instance of the VB software (but not properly - and some variables are not loaded in this second instance - i assume this) hence i get the following error:
Creating an instance of the COM component with CLSID {...} from the IClassFactory failed due to the following error: 800a0005 Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL).
I have configured IIS and the app pool identity and authentication so that IIS/worker process is starting as the same user as the VB software is run as (both elevated).
I am not sure on how to force the w3w worker process to see the already running VB exe and prevent it from running a new instance of it.
When I am developing in visual studio 2019, and the web API is run via IIS express, everything works fine.
Thank you
I have 32-bit DLL which was registered on Windows Server 2000. Now, we are process of upgrading it to 64 bit windows server 2012 so i want to use this DLL on the new server.
I tried using 32-bit tools (c:\windows\syswow64\regsvr32.exe) to register them to registry. I also made sure the entry exist in registry (using syswow64\regedit32.exe) at HKey_Classes_Root\Wow6432Node\CLSID[GUID] with AppID registered with DLL GUID and DLLSurrogate is enabled at HKey_Classes_Root\Wow6432Node\AppID[GUID]
I also made sure i have enabled 32-bit applications on the Application Pool inside the IIS.
But when i run the code, In my code where it is trying to create a com object for the dll, it sits there executing with a timeout error.
Can anyone please help what can i do/add to make this working. Thanks
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?
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
I developed an application (C# Framework 4) using the fdf toolkit running on a 32 bit server and everything works well.
I have migrated this application to a Windows Server 2008 SP2 64 Bits and sometimes this application gives me this error:
System.Runtime.InteropServices.COMException (0x800703FA): Retrieving
the COM class factory for component with CLSID
{CB830891-2E18-11D1-B8CF-00A0C9259304} failed due to the following
error: 800703fa Illegal operation attempted on a registry key that has
been marked for deletion.
After this error, I recycle the website pool and the application runs well again.
Details of the application:
Registered the libraries FDF.dll, FDFACX.dll and FDFTK.dll in c:\windows\SysWOW64.
Enabled in the web site pool the property 'Enable 32-Bit Applications'
Enabled 'Do not forcefully unload the user registry at user logoff ' property in the Group Policy Editor
Could you help me?
Thanks¡¡¡
What is the target platform you are building your application for? It will be either x86, x64, Itanium, or most likely "Any CPU".
You can try setting it to x86, that way you know everything is built to use the 32-bit version of .Net. Alternatively you can run CorFlags on your assembly(ies) to change it to x86 without recompiling.
If that doesn't solve the problem then we will need more code :)
I wrote a windows service (Win32 API) that uses a .NET assembly written in C#.
The service is set up to start automatically. In Windows XP all works well but under Vista the service is not automatically started (after reboot) because the .NET component is throwing an exception. But if I start the service manually, it works well.
It seems to be a security problem. The service is running under the local system account.