问题描述
xmal页面privatevoidButton_Click_1(objectsender,RoutedEventArgse){sc.IpcStringCompleted+=sc_IpcStringCompleted;sc.IpcStringAsync("2","192.168.1.119","","0","","");}wcfservices服务[OperationContract]publicvoidIpcString(stringtype,stringip,stringmac,stringcomType,stringuserName,stringpassword){_um.IpcString(type,ip,mac,comType,userName,password);}调用方法#region操作命令字符串通过ipc推送给服务publicvoidIpcString(stringtype,stringip,stringmac,stringcomType,stringuserName,stringpassword){RemoteObjectobjRemoteObject=ConnectServer();try{objRemoteObject.SendMessage(type+";"+ip+";"+mac+";"+comType+";"+userName+";"+password);//MessageBox.Show("发送成功");}catch(System.Runtime.Remoting.RemotingException){//MessageBox.Show("发送失败");}////获得当前已注册的通道;IChannel[]channels=ChannelServices.RegisteredChannels;for(inti=0;i<channels.Length;i++){if(channels[i].ChannelName=="ipcclient"){IpcClientChannelipcChannel=(IpcClientChannel)channels[i];ChannelServices.UnregisterChannel(ipcChannel);//注销通道}}}#endregion#region连接windows服务ipcserver管道privateRemoteObjectConnectServer(){try{IpcClientChannelchannel=newIpcClientChannel();ChannelServices.RegisterChannel(channel,false);RemoteObjectobjRemoteObject=(RemoteObject)Activator.GetObject(typeof(RemoteObject),"ipc://ipmi/RemoteObject");returnobjRemoteObject;}catch(Exception){throw;}}#endregionRemoteObject类publicclassRemoteObject:MarshalByRefObject{publicstaticQueue<string>qMessage{get;set;}//使用消息队列储存消息publicstringSendMessage(stringmessage){if(qMessage==null){qMessage=newQueue<string>();}qMessage.Enqueue(message);returnmessage;}}
解决方案
解决方案二:
自己顶下,来人呀
解决方案三:
这不都提示了么,无法加载那个DLL