2011-08-26 2 views
0

작업에서 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); 

내 "클라이언트"양식 연결을 시도

, 나는 그것을 진술, 연결 오류 지정한 파일을 찾을 수 없습니다.

도움 주셔서 감사합니다.

+0

에 서버

<configuration> <system.runtime.remoting> <application> <service> <activated type="Hello.AddService, Hello"/> </service> </application> </system.runtime.remoting> </configuration> 

과 같이 같은 것을 추가해야합니다. 이제 작동 중입니다. 클라이언트와 서버 모두에서 채널 이름과 portName을 반전 시켰고 클라이언트와 서버에서 동일한 채널 이름을 사용했습니다. 이제는 잘못된 것입니다. –

답변

0

리모팅 구성 파일을 찾고 있습니다. 더 많은 정보 http://msdn.microsoft.com/en-us/library/ms973907.aspx

여기를 봐 기본적으로 클라이언트 내가 실수의 몇 가지를 만들었다

<configuration> 
    <system.runtime.remoting> 
    <application> 
     <client url="http://localhost:8000> 
     <activated type="Hello.AddService, Hello"/> 
     </client> 
    </application> 
    </system.runtime.remoting> 
</configuration> 
+0

동일한 프로젝트가 아니기 때문에 의사 소통을 할 수 없습니까? –

+0

그들은 같은 기계에 있다면 그들은 알맞게 쉽게 합리적인 의사 소통을해야합니다. 원격 구성 파일을 찾을 수없는 경우 원격 구성 오류를 찾을 수 없습니다. 사용자의 오류라고 가정합니다. 당신은 전체 텍스트 – kmcc049

+0

을 추가 할 수 있습니까?하지만 VS2005가 프랑스어로되어 있기 때문에 프랑스어 메시지 만 수신합니다 ... –