开发者

IpcServerChannel properties problem

开发者 https://www.devze.com 2023-03-29 15:14 出处:网络
I\'ve got to write a service program and a program to maintain it in C#.I can\'t use .net 3 or 4, so I\'m stick with .Net 2.0.I\'ve learn that IPC channels could help me but I\'ve got problem using th

I've got to write a service program and a program to maintain it in C#. I can't use .net 3 or 4, so I'm stick with .Net 2.0. I've learn that IPC channels could help me but I've got problem using them.

I'm trying to create my IpcServerChannel using IDictionary as a properties list. But I can't get to find the good properties to send.

Here's my list

IDictionary properties = new Hashtable();

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

channel = new IpcServerChannel(properties,null);

When trying to run th开发者_如何学Gois, I got an IdentityNotMappedException error. Do you guys have any idea?


The user names are dependant on the Windows languange:

You can use the SID code of the Account and also the Sid constants. For example "WellKnownSidType.WorldSid" is the same as "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);


Okay, I've got something.

The fact is that all information I found about IPC was in English, so it was using the "Users" group. The computer I'm working on is in French, so the "Users" group is named "Utilisateurs". I corrected it, and it is now working.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号