Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Component Services / September 2005

Tip: Looking for answers? Try searching our database.

Unable to cast COM object of type 'System.__ComObject' Error Message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
D. Janknecht - 17 Jun 2005 13:24 GMT
Hello,

after turning my Serviced Component into a server-application, i cannot call
any methods and the following error message occurs:

"Unable to cast COM object of type 'System.__ComObject' to interface type
'ESServerTest.IServer'. This operation failed because the QueryInterface
call on the COM component for the interface with IID
'{70924D77-7D69-3C0C-A5D8-3C6FD029F799}' failed with HRESULT: 0x80004002
(Schnittstelle nicht unterstützt (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)))."

Where "Schnittstelle nicht unterstützt" means "Interface not supported"

I'm using VS2005 Beta2. Here is the code of my ServicedComponent:

namespace ESServerTest
{
   [Guid("CAAD4F2A-52E8-4b7c-82DE-0B013A010900")]
   public interface IServer
   {
       string SaySomething(string text);
   }
   [ComVisible(true)]
   [Guid("3725FED2-C5B1-4789-9125-1B3E32CA7D9E")]
   [ComponentAccessControl(true)]
   [ClassInterface(ClassInterfaceType.None)]
   public class ESServer : ServicedComponent, IServer
   {
       [ComVisible(true)]
       public string SaySomething(string text)
       {
           return text;
       }
  }
}

I try to call the method "SaySomething" by:
ESServerTest.ESServer test = new ESServerTest;
MessageBox.Show(test.SaySomething("Test"));

I've already installed the assembly into the GAC, so this isn't the problem.
Does somebody have an idea?

Thanks,
Dirk
cyberzuhalter@hotmail.com - 11 Jul 2005 15:53 GMT
Dirk,

Have you found a solution to your problem?  I'm having an IDENTICAL problem now.

Thanks for any help.

-Boby
D. Janknecht - 25 Jul 2005 11:09 GMT
Sorry Boby,

no solution so far. We have posted it as a bug...

Dirk

> Dirk,
>
[quoted text clipped - 9 lines]
> Comprehensive, categorised, searchable collection of links to ASP &
> ASP.NET resources...
D. Janknecht - 27 Jul 2005 10:21 GMT
Hi Boby,

i removed all GUIDs and "ComVisible" attributes from the class, then
switched the [assembly: ComVisible(true)] attribute in the
AssemblyInfo-File to 'true'.

Now it works.

Dirk

> Sorry Boby,
>
[quoted text clipped - 15 lines]
>> Comprehensive, categorised, searchable collection of links to ASP &
>> ASP.NET resources...
Michael Dyrnaes - 03 Aug 2005 06:05 GMT
Has anyone found a solution to this problem ???

Visual Studio 2005 Enhanced Edition Beta 2.

1.  On the right column of the development screen I select the tab DATA
SOURCE.
2.  Click on the link in window above that says ADD NEW DATA SOURCE.
3.  Click on the data source type WEB SERVICES and then click on the
NEXT button.
4.  In the URL field I type in the URL and then I click on the GO
button.
5.  WEB DISCOVERY SERVICE dialog and I click on the YES button.
6.  I enter the URL, USER NAME, PASSWORD, DOMAIN and click on the YES
button.
7.  The error message above appears in a window with the heading "Web
services
found at this URL" and the dialog reappears with everything except the
PASSWORD visible.

Error Message ...

"Unable to cast COM object of type 'System.__ComObject' to interface
type 'EnvDTE.IVsExtensibility'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{3C536122-57B1-46DE-AB34-ACC524140093}' failed with HRESULT: 0x80004002
(No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)))."
Fidias Gil de Montes - 15 Sep 2005 23:49 GMT
I have a similar problem. I receive the message:

************** Exception Text **************
System.InvalidCastException: Unable to cast object of type
System.__ComObject to type System.Data.DataSet.

Server stack trace:
  at servidor.IclaseSvr.prueba2(DataSet ds)
  at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
  at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
  at servidor.claseSvr.prueba2(DataSet ds)
  at cliente.frmPrincipal.Button1_Click(Object sender, EventArgs e) in
d:\My Documents\Visual Studio
Projects\ErrorComObject\cliente\frmPrincipal.vb:line 113
  at System.Windows.Forms.Control.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  at System.Windows.Forms.Button.WndProc(Message& m)
  at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

when the client calls the server.  However if the Application COM's identity
is the same that the client's user ID, all works fine.

My server code is:

<SecureMethod()> _
Public Class claseSvr
   Inherits ServicedComponent
   Implements IclaseSvr

   Public Sub prueba2(ByVal ds As DataSet) _
       Implements IclaseSvr.prueba2
             '<My Code Here>
   End Sub

End Class

Public Interface IclaseSvr
   Sub prueba2(ByVal ds As DataSet)
End Interface

My Client code:

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       Dim svr As New servidor.claseSvr
       Dim ds As DataSet

           ds = New DataSet
           '<some code>
           svr.prueba2(ds)
   End Sub

Some guess?

Thanks,

Fidias Gil de Montes

> Hello,
>
[quoted text clipped - 42 lines]
> Thanks,
> Dirk

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.