0
Answer

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

Hi Everybody,
 
I have a problem in my project. I coded an app that works like teamviewer. It is two side in project.(ClientSide and ServerSide) 
 
The problem is on my Client Side Project. My Codes are these :
 
 
public static RDPSession oturumum = null;
private static void GelenKisi(object Misafir)
{
IRDPSRAPIAttendee Misafirim = (IRDPSRAPIAttendee)Misafir;
Misafirim.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_MAX;
}
public static void OturumOlustur()
{
oturumum = new RDPSession();
}
public static void Baglan(RDPSession oturum)
{
oturum.OnAttendeeConnected += GelenKisi;
oturum.Open();
}
public static void BaglantiKes(RDPSession oturum)
{
oturum.Close();
}
public static string BaglantiKodu(RDPSession oturum, String Kullanici, string Grup, string Parola, int BaglantiLimitim)
{
IRDPSRAPIInvitation Davet = oturum.Invitations.CreateInvitation(Kullanici,Grup,Parola,BaglantiLimitim);
return Davet.ConnectionString;
}
private void button1_Click(object sender, EventArgs e)
{
OturumOlustur();
Baglan(oturumum);
textBox1.Text = BaglantiKodu(oturumum,"UzakKullanici","UzakGrup","",1);
}
 
When I want to debug these codes on my client I take this error :
 

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'RDPCOMAPILib.RDPSession'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FEE4EE57-E3E8-4205-8FB0-8FD1D0675C21}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 I googled for it many times but i couldnt solve the problem. Please help me.
 
Thanks..