I have a IE Browser Helper Object, which is a Toolbar addin for IE 8. I have another .NET .EXE application (Remoting Client) that connects to this BHO (Remoting Server) using remoting via common Interface. When I test the communication between the .EXE application and a TEMP Console application with the same code used in the Server component, it communicates fine, and runs the remote Method.
However, when i try and communicate with the BHO server with security on the TCP cahannel ON ChannelServices.RegisterChannel(tcpClientChannel, true); , I get a "FileNotFoundException" Could not load file or assembly "xxxx" which "xxxx" is the common Interface assembly that contains the Server Methods.
When i try and communicate with the BHO server with security on the TCP cahannel OFF ChannelServices.RegisterChannel(tcpClientChannel, false); , I get error "connection to the remote object was forcably closed".
If I re-test it with the simple test console app it work.
Im starting to believe the problem is with the way remoting works inside a BHO instance... Has anyone used Remoting in a BHO .NET instance, Im using the SPICIE library to create the BHO using .NET.
COMMON Interface assembly for Remoting Interface Object namespace WWie.CommonClasses { class WWieRemote : MarshalByRefObject, WWieClassLibrary.WWieCommonClass.IGetHtmlElement { public string GetElementClicked() { return ("Returned from WWieRemote "); }
public void SetElementClicked(string str)
{
MessageBox.Show("SetElement " + str);
}
}
}
CLIENT APP static TcpChannel tcpClientChannel = new TcpChannel(); public static WWieClassLibrary.WWieCommonClass.IGetHtmlElement remoteObject; ChannelServices.RegisterChannel(tcpClientChannel, false); remoteObject = (WWieClassLibrary.WWieCommonClass.IGetHtmlElement)Activator.GetObject(typeof(WWieClassLibrary.WWieCommonClass.IGetHtmlElement), "tcp://localhost:9002/TestWWie");
testing with remote method call
remoteObject.SetElementClicked("from Client");
SERVER BHO TcpChannel tcpServerChannel = new TcpChannel(9002); ChannelServices.RegisterChannel(tcpServerChannel, true); RemotingConfiguration.RegisterWellKnownServiceType(typeof(WWieClassLibrary.WWieCommonClass.IGetHtmlElement), "TestWWie", WellKnownObjectMode.Singleton);