?
Solved

COM+ error System.InvalidCastException

Posted on 2004-08-31
3
Medium Priority
?
384 Views
Last Modified: 2012-06-27
Hi All,
 I have a COM component that i have installed as a server component. I create an instance of the component in my .aspx file. It worked fine for some time, then i changed another component that the com calls and i started getting a message
System.InvalidCastException: Specified cast is not valid
[InvalidCastException: Specified cast is not valid.]
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo) +0
   System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
   System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
   System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props, Boolean bNewObj) +74
   intersoft.ptList.WebGrid1_InitializeDataSource(Object sender, DataSourceEventArgs e) in c:\inetpub\wwwroot\uilayer\ptlist.ascx.cs:179
   ISNet.WebUI.WebGrid.WebGrid.OnInitializeDataSource(Object dataSource)
   ISNet.WebUI.WebGrid.WebGrid.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

Can somebody help me with this problem,
Thanks,
Preetham.
0
Comment
Question by:kingpreetham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
NipNFriar_Tuck earned 200 total points
ID: 11953561
There is a good possibility that when you changed the code the GUID for the class changed.  You can prevent this from happening by adding a GUID attribute [GUID("###")] to the classes and interfaces used in the com piece also in the code that the com piece calls...

Another possiblity is of the namespace changed then even though the class is exactly the same you will not be able to cast from one to another...

Anyhow, these are two situations that I have ran into that may explain what is happening to you...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question