, , , , - . , :
:
Dictionary<string, object> properties = new Dictionary<string, object>();
properties["authorizedGroup"] = GetUsersGroupName();
properties["name"] = configuration.ServiceShortName + ".Server";
properties["portName"] = configuration.ServiceGuid;
BinaryServerFormatterSinkProvider sinkProvider = new BinaryServerFormatterSinkProvider();
sinkProvider.TypeFilterLevel = TypeFilterLevel.Full;
Channel = new IpcServerChannel(properties, sinkProvider);
Channel.IsSecured = true;
ChannelServices.RegisterChannel(Channel, true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(AppManagerServer), configuration.ServerObjectUrl, WellKnownObjectMode.SingleCall);
string GetUsersGroupName()
{
const string builtInUsersGroup = "S-1-5-32-545";
SecurityIdentifier sid = new SecurityIdentifier(builtInUsersGroup);
NTAccount ntAccount = (NTAccount)sid.Translate(typeof(NTAccount));
return ntAccount.Value;
}
:
channel = new IpcClientChannel(AppManagerConfiguration.Instance.ServiceShortName + ".Client", null);
ChannelServices.RegisterChannel(channel, true);
string appManagerUrl = "ipc://" + AppManagerConfiguration.Instance.ServiceGuid + "/" + AppManagerConfiguration.Instance.ServerObjectUrl;
(IAppManager)Activator.GetObject(typeof(IAppManager), appManagerUrl).DoSomething();
:
: System.Security.SecurityException: .
System.Security.Principal.WindowsIdentity.GetCurrentInternal(TokenAccessLevels wishAccess, Boolean threadOnly)
System.Security.Principal.WindowsIdentity.GetCurrent()
System.Runtime.Remoting.Channels.Ipc.IpcServerTransportSink.ServiceRequest( )
:
MyComputer