2011-08-19 3 views
1

C#으로 유지 관리하기 위해 서비스 프로그램과 프로그램을 작성해야합니다. .net 3 또는 4를 사용할 수 없으므로 .Net 2.0을 사용합니다. 나는 IPC 채널이 나를 도울 수 있다는 것을 배웠지 만, 나는 그들을 사용하는 데 문제가있다.IpcServerChannel 속성 문제

을 속성 목록으로 사용하여 IpcServerChannel을 만들려고합니다. 하지만 보낼 좋은 속성을 찾을 수 없습니다.

여기 내 목록

IDictionary properties = new Hashtable(); 

properties.Add("authorizedGroup", "Users"); 
properties.Add("portName", "ServerChannel"); 

channel = new IpcServerChannel(properties,null); 

이 실행하려고, 나는 IdentityNotMappedException 오류가 발생했습니다. 너희들 생각 나니?

답변

0

좋아요, 뭔가 있습니다.

실제로 IPC에서 발견 한 모든 정보는 영어로되어 있으므로 "사용자"그룹을 사용하고있었습니다. 내가하고있는 컴퓨터는 프랑스어로되어있어 "사용자"그룹은 "Utilisateurs"라는 이름으로되어 있습니다. 나는 그것을 바로 잡았고 이제는 효과가있다.

2

사용자 이름은 윈도우 languange에 따라 달라집니다 :

당신은 계정의 SID 코드 또한 시드 상수를 사용할 수 있습니다. 예를 들어 "WellKnownSidType.WorldSid"는 "EveryOne"과 같습니다.

// Get SID code for the EveryOne user 
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null); 
// Get the NT account related to the SID 
NTAccount account = sid.Translate(typeof(NTAccount)) as NTAccount; 

// Put the account locale name to the properties 
properties.Add("authorizedGroup", account.Value);