작업에서 IPC를 사용하여 서비스 프로그램이 사용자 프로그램과 통신하도록합니다. 나는 사용자가 서비스 프로그램 IPC에 연결하게 할 수 없다. 여기 IPC 채널 연결 문제
내 코드입니다 :서버 :
string name = application + "-" + cie + "-" + instance ;
IDictionary properties = new Hashtable();
properties.Add("authorizedGroup", "Utilisateurs");
properties.Add("name", "CI.EventChannel");
properties.Add("portName", name);
if (ChannelServices.GetChannel(name) != null)
ChannelServices.UnregisterChannel(ChannelServices.GetChannel(name));
channel = new IpcServerChannel(properties,null);
ChannelServices.RegisterChannel(channel, true);
//Register this service type.
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(IpcServerMethodsEventGenerator),
"IpcServerMethodsEventGenerator", WellKnownObjectMode.Singleton);
클라이언트 :
IDictionary properties = new Hashtable();
properties.Add("authorizedGroup", "Utilisateurs");
properties.Add("name", "CI.EventChannel");
properties.Add("portName", ipc); //ipc values "EventGenerator-002-1"
ipc = "ipc://" + ipc;
//Create an IPC client channel.
IpcClientChannel channel = new IpcClientChannel(properties,null);
//Register the channel with ChannelServices. (channel, security)
if (ChannelServices.GetChannel(channel.ChannelName) != null)
ChannelServices.UnregisterChannel(ChannelServices.GetChannel(channel.ChannelName));
ChannelServices.RegisterChannel(channel, true);
//Register the client type.
if (register)
RemotingConfiguration.RegisterWellKnownClientType(typeof(IpcServerMethodsEventGenerator), ipc);
내 "클라이언트"양식 연결을 시도
, 나는 그것을 진술, 연결 오류 지정한 파일을 찾을 수 없습니다.도움 주셔서 감사합니다.
에 서버
과 같이 같은 것을 추가해야합니다. 이제 작동 중입니다. 클라이언트와 서버 모두에서 채널 이름과 portName을 반전 시켰고 클라이언트와 서버에서 동일한 채널 이름을 사용했습니다. 이제는 잘못된 것입니다. –