开发者

.NET IE BHO Remoting

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(9开发者_如何学编程002); ChannelServices.RegisterChannel(tcpServerChannel, true); RemotingConfiguration.RegisterWellKnownServiceType(typeof(WWieClassLibrary.WWieCommonClass.IGetHtmlElement), "TestWWie", WellKnownObjectMode.Singleton);


Since IE is running in protected mode by default, it usually doesn't have access to communicate with higher integrity processes. If your url is in the intranet zone, you can push a policy that disable protected mode for the intranet zone. Otherwise you may want to look for other options, like shared memory, named pipe, hidden worker windows & registered messages & customized message filter for Vista's UIPI, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜