473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Unable to cast COM object of type 'System.__ComObject' to interface type


[ERROR MESSAGE:]
Unable to cast COM object of type 'System.__ComObject' to interface
type 'Manage.Statistics.IManageStats'. This operation failed because
the QueryInterface call on the COM component for the interface with IID
'{4C2875B5-3265-306B-9C74-1BEC98986B1A}' failed due to the following
error: Error loading type library/DLL. (Exception from HRESULT:
0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

The client is calling a method shown below (exposed by a custom written
COM+ Application):

dim blnResult as Boolean

dim m_ManageStats as Manage.Statistics.IManageStats = new
Manage.Statistics.ManageStats

'*** Exception thrown by the following statment ***
blnResult = m_ManageStats.DeleteStatSheetWorkItem(intStatWorkI temID)

NB. The call should flow as shown:
--------------------------------------
[Client App]<-->[Application Proxy]<-->[COM+ Application]<-->[SQL
Server 2000 DBMS]<-->[Database Stored Procedure]

The interfaces etc are summarised below.

N.B. Some of the exposed methods in the same interface below work as
expected.
ALSO The client works fine when calling methods on the same host as
COM+ Application.

Below is the header for the 'ManageStats' COM+ Application

After Building the ManageStats.dll it is installed and registered as
followed:

Regsvcs.exe ManageStats.dll 'Installs and registers the COM+
Application called "IPB Business Services"
GacUtil.exe /i ManageStats.dll 'Intalls the assembly in the Global
Assembly Cache - Doesn't work without this.

<Assembly: ApplicationName("IPB Business Services")>
<Assembly: ApplicationActivation(ActivationOption.Server)>
<Assembly: Description("IPB Business Services - Application Component
Services")>
<Assembly: AssemblyKeyFileAttribute("sgMStats.snk")>
<Assembly: ApplicationAccessControl(True)>

Namespace Statistics

Public Interface IManageStats

Function DeleteStatSheetWorkItem(ByRef intStatWorkItemID As Short)
As Boolean
Function GetWorkItems() As ADODB.Recordset
Function GetSubmittedSheets(ByRef sUserName As String) As
ADODB.Recordset
Function GetWorkItemDetail(ByRef intDailyStatID As Short) As
ADODB.Recordset

End Interface

<ConstructionEnabled( _
[Default]:="DBServer=, Database=, DBUserName=, DBPassword="), _
ComponentAccessControl(True), _
Transaction(TransactionOption.Required)> _
Public Class ManageStats
Inherits ServicedComponent
Implements Statistics.IManageStats

Public Function DeleteStatSheetWorkItem(ByRef intStatWorkItemID As
Short) _
As Boolean _
Implements
Statistics.IManageStats.DeleteStatSheetWorkItem ....
Public Function GetWorkItems() As ADODB.Recordset _
Implements
Statistics.IManageStats.GetWorkItems ....
End Class

End Namespace
--
mminto
------------------------------------------------------------------------
mminto's Profile: http://www.hightechtalks.com/m771
View this thread: http://www.hightechtalks.com/t2337796

Jan 20 '06 #1
1 31123
SG
This looks like an error I've encountered before. There's a writeup specific
to our software here, but the issue I think is the same - try using the
System.Activator class to instantiate instead of the new keyword:
Type t = Type.GetTypeFromProgID("libname.classname");
System.Object obj = Activator.CreateInstance(t);
IMyInterface myclass = obj as IMyInterface;

See the writeup at:
http://edndoc.esri.com/arcobjects/9....mComObject.htm
Jan 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fidias Gil de Montes | last post by:
In a Distributed Windows application, I receive the following message when the client calls the server: ************** Exception Text ************** System.InvalidCastException: Unable to cast...
6
by: Catherine Jones | last post by:
Hi all, we need urgent help in a matter. We are trying to pass a COM object from the client to server and are facing some problems in the same. We've our client in C# as well as the Server...
3
by: mra | last post by:
I want to cast an object that I have created from a typename to the corresponding type. Can anycone tell me how to do this? Example: //Here, Create the object of type "MyClass" object...
3
by: aljamala | last post by:
Hello, I have the following method to help me in installing some COM components onto the machine...below is a snippet that is causing the problem... Type objType = null; COMAdminCatalog...
1
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have a master page and a content page to that master. When I try to work with them I get an inconsistent error of casting ability and it happens irregularly, which means sometimes it can work...
0
by: dhaval321 | last post by:
Hello, Actually i am making plugin in spinfire software..And when i m using threading then the error of "Unable to cast COM object of type 'System.__ComObject' to interface type...
0
by: dhaval321 | last post by:
Hello, Actually i am making plugin in spinfire software..And when i m using threading then the error of "Unable to cast COM object of type 'System.__ComObject' to interface type...
2
by: Daniel =?iso-8859-1?Q?Lidstr=F6m?= | last post by:
Hi! I want to know if a certain member function is available in a COM object, before I try to call it. I'm using late binding and when I know the member exists, everything is fine. Here's the...
2
by: Bigi | last post by:
Hi, Please help, this has been driving me nuts for nearly 2 days now. This vb6 code works: Public oEng As New ebizEngine Public oMsg As ebizMessage Function EbizGetFromQueue() As String
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.