我有一个IE浏览器辅助对象,它是IE 8的工具栏插件。 我有另一个.NET .EXE应用程序(远程处理客户端)通过远程连接通过远程处理通用接口。 当我使用服务器组件中使用的相同代码测试.EXE应用程序和TEMP控制台应用程序之间的通信时,它通信正常,并运行远程方法。.NET IE浏览器BHO远程处理
但是,当我尝试与TCP通道上的安全通信与BHO服务器ON ChannelServices.RegisterChannel(tcpClientChannel,true); ,我得到一个“FileNotFoundException”无法加载文件或程序集“xxxx”,其中“xxxx”是包含服务器方法的通用接口程序集。
当我尝试与TCP通道上的安全通信与BHO服务器OFF ChannelServices.RegisterChannel(tcpClientChannel,false); ,我得到错误“与远程对象的连接被强制关闭”。
如果我用简单的测试控制台应用程序重新测试它的工作。
我开始相信问题是在远程处理方式在BHO实例内工作的方式......有没有人在BHO .NET实例中使用Remoting,我使用SPICIE库来创建使用.NET的BHO。
用于远程处理接口对象 命名空间WWie.CommonClasses通用接口组件 { 类WWieRemote:MarshalByRefObject的,WWieClassLibrary.WWieCommonClass.IGetHtmlElement { 公共字符串GetElementClicked() { 返回( “从WWieRemote返回”); }
public void SetElementClicked(string str)
{
MessageBox.Show("SetElement " + str);
}
}
}
CLIENT APP 静态的TcpChannel tcpClientChannel =新的TcpChannel(); public static WWieClassLibrary.WWieCommonClass.IGetHtmlElement remoteObject;ChannelServices.RegisterChannel(tcpClientChannel,false); (WWieClassLibrary.WWieCommonClass.IGetHtmlElement),“tcp:// localhost:9002/TestWWie”);
与远程方法调用
remoteObject.SetElementClicked("from Client");
SERVER BHO 的TcpChannel tcpServerChannel =新的TcpChannel(9002)测试;ChannelServices.RegisterChannel(tcpServerChannel,true); 012ofRemotingConfiguration.RegisterWellKnownServiceType(typeof(WWieClassLibrary.WWieCommonClass.IGetHtmlElement),“TestWWie”,WellKnownObjectMode.Singleton);
Appologies我忘了说在客户端和服务器在同一台机器上运行,所以网址为tcp://本地主机:9002 /服务名称 – PrimeTSS 2009-11-18 21:09:08
这是错误即时得到 System.Net.Sockets.SocketException了未处理 消息= 源 “的现有连接被强行关闭远程主机”= “mscorlib程序” 错误码= 10054 NativeErrorCode = 10054 的ExecutionContext,ContextCallback回调,对象状态) 在System.Threading.ThreadHelper.ThreadStart() InnerException: – PrimeTSS 2009-11-18 21:13:17
Netstat -a将端口显示为监听,并且我关闭了防火墙并将本地主机添加到了tru sted sites – PrimeTSS 2009-11-18 21:15:43