示例#1
0
        internal static ServerIdentity GetServerIdentity(IMessage reqMsg)
        {
            ServerIdentity   serverIdentity  = null;
            bool             flag            = false;
            IInternalMessage internalMessage = reqMsg as IInternalMessage;

            if (internalMessage != null)
            {
                serverIdentity = ((IInternalMessage)reqMsg).ServerIdentityObject;
                flag           = true;
            }
            else if (reqMsg is InternalMessageWrapper)
            {
                serverIdentity = (ServerIdentity)((InternalMessageWrapper)reqMsg).GetServerIdentityObject();
            }
            if (serverIdentity == null)
            {
                string   uri      = InternalSink.GetURI(reqMsg);
                Identity identity = IdentityHolder.ResolveIdentity(uri);
                if (identity is ServerIdentity)
                {
                    serverIdentity = (ServerIdentity)identity;
                    if (flag)
                    {
                        internalMessage.ServerIdentityObject = serverIdentity;
                    }
                }
            }
            return(serverIdentity);
        }
示例#2
0
        internal static Identity GetIdentity(IMessage reqMsg)
        {
            Identity identity = null;

            if (reqMsg is IInternalMessage)
            {
                identity = ((IInternalMessage)reqMsg).IdentityObject;
            }
            else if (reqMsg is InternalMessageWrapper)
            {
                identity = (Identity)((InternalMessageWrapper)reqMsg).GetIdentityObject();
            }
            if (identity == null)
            {
                string uri = InternalSink.GetURI(reqMsg);
                identity = IdentityHolder.ResolveIdentity(uri);
                if (identity == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Remoting_ServerObjectNotFound", new object[]
                    {
                        uri
                    }));
                }
            }
            return(identity);
        }
示例#3
0
        internal static ServerIdentity GetServerIdentity(IMessage reqMsg)
        {
            ServerIdentity   serverIdentityObject = null;
            bool             flag    = false;
            IInternalMessage message = reqMsg as IInternalMessage;

            if (message != null)
            {
                serverIdentityObject = ((IInternalMessage)reqMsg).ServerIdentityObject;
                flag = true;
            }
            else if (reqMsg is InternalMessageWrapper)
            {
                serverIdentityObject = (ServerIdentity)((InternalMessageWrapper)reqMsg).GetServerIdentityObject();
            }
            if (serverIdentityObject == null)
            {
                Identity identity2 = IdentityHolder.ResolveIdentity(GetURI(reqMsg));
                if (identity2 is ServerIdentity)
                {
                    serverIdentityObject = (ServerIdentity)identity2;
                    if (flag)
                    {
                        message.ServerIdentityObject = serverIdentityObject;
                    }
                }
            }
            return(serverIdentityObject);
        }
        [System.Security.SecurityCritical]  // auto-generated
        internal static Identity GetIdentity(IMessage reqMsg)
        {
            Identity id = null;

            if (reqMsg is IInternalMessage)
            {
                id = ((IInternalMessage)reqMsg).IdentityObject;
            }
            else if (reqMsg is InternalMessageWrapper)
            {
                id = (Identity)((InternalMessageWrapper)reqMsg).GetIdentityObject();
            }

            // Try the slow path if the identity has not been obtained yet
            if (null == id)
            {
                String objURI = GetURI(reqMsg);

                id = IdentityHolder.ResolveIdentity(objURI);

                // An object could get disconnected on another thread while a call is in progress
                if (id == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Remoting_ServerObjectNotFound", objURI));
                }
            }

            return(id);
        }
示例#5
0
        internal static void StartListeningForRemoteRequests()
        {
            Startup();
            DomainSpecificRemotingData remotingData = Thread.GetDomain().RemotingData;

            if (!remotingData.ActivatorListening)
            {
                object configLock = remotingData.ConfigLock;
                bool   lockTaken  = false;
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    Monitor.Enter(configLock, ref lockTaken);
                    if (!remotingData.ActivatorListening)
                    {
                        RemotingServices.MarshalInternal(Thread.GetDomain().RemotingData.ActivationListener, "RemoteActivationService.rem", typeof(IActivator));
                        ((ServerIdentity)IdentityHolder.ResolveIdentity("RemoteActivationService.rem")).SetSingletonObjectMode();
                        remotingData.ActivatorListening = true;
                    }
                }
                finally
                {
                    if (lockTaken)
                    {
                        Monitor.Exit(configLock);
                    }
                }
            }
        }
        [System.Security.SecurityCritical]  // auto-generated
        internal static ServerIdentity GetServerIdentity(IMessage reqMsg)
        {
            ServerIdentity srvID   = null;
            bool           bOurMsg = false;
            String         objURI  = null;

            IInternalMessage iim = reqMsg as IInternalMessage;

            if (iim != null)
            {
                Message.DebugOut("GetServerIdentity.ServerIdentity from IInternalMessage\n");
                srvID   = ((IInternalMessage)reqMsg).ServerIdentityObject;
                bOurMsg = true;
            }
            else if (reqMsg is InternalMessageWrapper)
            {
                srvID = (ServerIdentity)((InternalMessageWrapper)reqMsg).GetServerIdentityObject();
            }

            // Try the slow path if the identity has not been obtained yet
            if (null == srvID)
            {
                Message.DebugOut("GetServerIdentity.ServerIdentity from IMethodCallMessage\n");
                objURI = GetURI(reqMsg);
                Identity id =
                    IdentityHolder.ResolveIdentity(objURI);
                if (id is ServerIdentity)
                {
                    srvID = (ServerIdentity)id;

                    // Cache the serverIdentity in the message
                    if (bOurMsg)
                    {
                        iim.ServerIdentityObject = srvID;
                    }
                }
            }

            return(srvID);
        }