I've got this annoying issue in here when using a VB6 DLL (AB5COM.dll) in my webAPI project.
All is working fine in my local VS2015. The problem occurs only in my remote IIS 7.5 (Win2008 R2) after deploying the published site.
I'm using this DLL in 2 projects of my solution.
I've tried several things -
Generating interop.AB5COM
Disable embed and copy local
platform change to x86
APP POOL supports 32bit
[assembly: ComVisible(true)]
Adding [Guid("xxxxxxx-xxxxx-xxxxxx-xxxxxx")] as attribute in my class
All was useless. Local VS2015 works, remote IIS7.5 fails with this exception.
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'AB5COM.trxAB5core'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{AF42661C-D369-454A-A005-55D51037166A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I also can't find which DLL I need to register using regsvr32 since the COM dll isn't published, and the interop cannot be registered.
Would appreciate your help on this.
Thx
Ok, since no answer on this, I had to make some moves...
The remote IIS environment is my TEST server, so I've installed VS2017 with my solution, ran my app (success) and published (success).
So currently I have no issues with this COM DLL which brings the conclusion that this is a pure REGISTRY issue. The VS2015 knows how to register the correct DLL and then all works perfectly.
Now, I need to figure how to make this working on my Production...
Although this is NOT a proper solution, I hope my personal post helps anyone.
Related
I am trying to integrate to ZKTeco bio-metric device with my web application. It's working absolutely fine but when I deploy application and try to connect with bio-metric device I get the following error:
Retrieving the COM class factory for component with CLSID {00853A19-BD51-419B-9269-2DABE57EB61F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I am following this tutorial.
I tried following solutions:
I changed the reference of my dll to copy to local.
I changed the targeted CPU before deploying.
But both the solutions didn't work. What could be possible solution?
You must register zkemkeeper in every computer that will use your program, not just in the development environment.
To register the zkemkeeper dll in both development and deployment computers, follow the steps provided in the solution of this post: Error when inserting finger print data into database table. When registering in deployment computers, avoid the steps related with the Visual Studio.
You should also take a look to this document, it provides useful information to understand how zkemkeeper works: COM Class Objects and CLSIDs.
Best regards.
I'm planning to run my coded UI test from another project (in same solution). I added a reference of the CUIT project to my winform app project. Also I added these references as well
Microsoft.VisualStudio.TestTools.UITesting.dll
Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
Microsoft.VisualStudio.TestTools.UITest.CodeGeneration.dll
Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Microsoft.VisualStudio.TestTools.UITest.Playback.dll
My code is something like this
Playback.Initialize();
TestProject.CodedUITest1 coded = new TestProject.CodedUITest1();
coded.CodedUITestMethod1();
Playback.Cleanup();
However, I get an exception on the Playback.Initialize() call.
this is the message...
"An unhandled exception of type 'Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll"
Someone said that installing Test agent 2010/Test agent10 can solve this error.
I installed MS Visual studio Test Agent 2010, but same error happens.
What am I doing wrong here?
Thanks
I tried to run the test the same way you do and it worked for me.
Below are the reference dlls I have added in my projects
Please make sure you have added all the dlls. In case you are not able to find the dlls, look for them in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies.
If this doesn't work please provide the details of inner exception.
I found an answer to my problem. I found that the message of the inner exception is
"Retrieving the COM class factory for component with CLSID {27876903-E697-4406-BF49-1B8B92CB8735} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
After digging around I found that I have a 32 bit third party dll which I'm running on my 64-bit machine. The conflict is 64 bit process trying to invoke 32 bit process in 64 bit machine.
The solution is to change the project properties to target to 'X86' machine instead of 'Any'.
In my WPF application I am using Microsoft.Office.Interop.Excel to import data from excel file. I have been using this code for last couple of months and it has been working just fine for me. Today all of a sudden when I ran the utility I got the following error.
Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
'Microsoft.Office.Interop.Excel._Application'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the
following error: Library not registered. (Exception from HRESULT:
0x8002801D (TYPE_E_LIBNOTREGISTERED)).
I had originally Office 2013 installed but 2 months ago I uninstalled and installed the 2007 version. Everything was working fine until now.
I have read on different posts to delete the registry entry corresponding to the above IID. I have tried doing that but no help. I uninstalled/repaired Office as well but no help.
I have tried to register the Microsoft.Office.interop.excel.dll using regasm.exe as well but again no luck. Whats the issue here?
I had a some problems with Interop. then I switched to Microsoft.Jet.OLEDB.4.0 don't know if it helps, but I found it to be much more stable.
I am writing a C# assembly that is called from an x64 process (SS Reporting Services) and needs to use an x86 3rd party COM assembly.
When I compile my assembly as x64, I get a "Class not registered" COM exception as soon as the first call to the COM assembly is made.
Following the advice here (sorry if my terminology is incorrect) I created a new COM+ application and added components found in the COM assembly I am referencing. When I run my assembly as x64 it does make some successful calls to the COM assembly until I get this error:
Unable to cast COM object of type 'TRIMSDK.RecordTypesClass' to interface type 'TRIMSDK.IBaseObjects'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{8A354545-6BCB-11D3-B273-00A0C9FC3DC0}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
'TRIMSDK.RecordTypesClass' does implement 'TRIMSDK.IBaseObjects' according to the class definition.
If I search the registry for the interface GUID from the error message or for 'IBaseObjects', no matches are found. Since creating the COM+ application I get the same error in x86 mode (which I guess makes sense), though it worked fine in x86 before that.
So, I assume the 'TRIMSDK.IBaseObjects' interface I'm trying to use isn't being registered as a COM+ thingy and I don't know why or how to fix it.
Any ideas? Thanks in advance.
Update: I think I am getting the E_NOINTERFACE exception for TRIMSDK.IBaseObjects because the TypeLibType attribute on the interface is set to 'FNonExtensible' only, whereas other interfaces I use successfully in the assembly also have 'FDispatchable'. Is it possible to get around this error (either altering the type library or manually registering the 'IBaseObjects' interface somehow)?
This is quite an old question, but I've just sorted this out in our environment after having been struggling with this issue for a while. I have very little experience with COM and/or Interop so excuse me if my terminology is a little off.
The error message I was getting was;
Unable to cast COM object of type 'TYSTransfer.TransferClass' to
interface type 'TYSTransfer._Transfer'. This operation failed because
the QueryInterface call on the COM component for the interface with
IID '{E825C39B-1EF3-4319-89FC-AEF62C8117B9}' failed due to the
following error: No such interface supported (Exception from HRESULT:
0x80004002 (E_NOINTERFACE)).
I was also struggling to find the interface GUID specified in the message. I looked in Component Services for the GUID assigned to our COM component and could see;
Then when I used DotPeek to look at the generated Interop class that I was using to access this COM component, I noticed that the associated GUID for the same interface was the one as was reported in my error;
So DotPeek showed me that the Guid being referenced was from my Interop class. It turned out that regenerating the Interop class against the target COM object generated a class with the correct Guids (at least they matched so I assumed they were correct), and utilising this fixed the issue for us.
The generated Interop class we were using during runtime was simply replaced with the regenerated one. Once the program was restarted with the new generated Interop class in place, it started working again.
The reason this issue simply appeared all of a sudden was due moving the code to a new server. I think something got mixed up during the move.
I am trying to change the Terminal Services settings programmaticly. I learned that you must use tsuserex.dll. Being c# i ran tsuserex through tlbimp and created TSUSEREXLib.dll then registered it with regasm. I got it working and wrote a framework program with it as a prof of concept. However today after I made some changes when I run my program I get the error
Unable to cast COM object of type 'System.__ComObject' to interface type 'TSUSEREXLib.IADsTSUserEx'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C4930E79-2989-4462-8A60-2FCF2F2955EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
it thows the exception on the line
IADsTSUserEx iad = (IADsTSUserEx)((DirectoryEntry)user.GetUnderlyingObject()).NativeObject;
This exact line worked fine in the test project. I know user is a valid UserPrincipal, Googleing I found this is usually just needs the dll re-registered, but even after unloading and reloading it it still will not work. What am I missing to cause my dll to stop working.
I know this is an old thread but since I had trouble recently finding all the required steps to get the Terminal Services components working on Windows 7, I wanted to share what I found. I think the steps below are more reliable than copying the tsuserex.dll from a server and trying to register it.
From what I understand, on any operating system you need Remote Server Administration Tools (RSAT) installed in order to modify Terminal Services attributes of a user account programmatically. On some versions of Windows this requires a download. But on Windows 7, RSAT is already installed.
But you may need to enable it using the configuration options in Control Panel (appwiz.cpl). Under "Turn Windows features on or off" goto "Remote Server Administration Tools" then ensure that "Remote Desktop Services Tools" is checked.
After I did this (and rebooted) I was able to use the components from tsuserex.dll via PowerShell (e.g., Set-QADUser -Identity testUser -TsHomeDirectory "c:\tshome"), and by adding a reference in Visual Studio 2010 (to "tsexusrm 1.0 Type Library").
You almost certainly need to re-register your TLB on the target machine. What likely happened is you have your assembly, interface or type GUID not hard coded in the application and hence it's changed on every rebuild. So after rebuilding and deploying your type no longer matches up with the previously registered TLB.
The correct answer is that I am a idiot for not reliseing that my build environment did change. I moved to a new workstaion that was windows 7 corprate instead of server 2003 when i started on the project. Win7 corp does not have tsuserex.dll in its system.
Visual Studio Build Setting „Platform target“ disable=> “Prefer 32-bit” solve the Problem.