} // CreateServerChannelSinkChain // Check if the object has been disconnected or if it is // a well known object then we have to create it lazily. internal static ServerIdentity CheckDisconnectedOrCreateWellKnownObject(IMessage msg) { ServerIdentity ident = InternalSink.GetServerIdentity(msg); BCLDebug.Trace("REMOTE", "Identity found = " + (ident == null ? "null" : "ServerIdentity")); // If the identity is null, then we should check whether the // request if for a well known object. If yes, then we should // create the well known object lazily and marshal it. if ((ident == null) || ident.IsRemoteDisconnected()) { String uri = InternalSink.GetURI(msg); BCLDebug.Trace("REMOTE", "URI " + uri); if (uri != null) { ServerIdentity newIdent = RemotingConfigHandler.CreateWellKnownObject(uri); if (newIdent != null) { // The uri was a registered wellknown object. ident = newIdent; BCLDebug.Trace("REMOTE", "Identity created = " + (ident == null ? "null" : "ServerIdentity")); } } } if ((ident == null) || (ident.IsRemoteDisconnected())) { String uri = InternalSink.GetURI(msg); throw new RemotingException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Disconnected"), uri)); } return(ident); }
internal static ServerIdentity CheckDisconnectedOrCreateWellKnownObject(IMessage msg) { ServerIdentity serverIdentity = InternalSink.GetServerIdentity(msg); if (serverIdentity == null || serverIdentity.IsRemoteDisconnected()) { string uri = InternalSink.GetURI(msg); if (uri != null) { ServerIdentity serverIdentity2 = RemotingConfigHandler.CreateWellKnownObject(uri); if (serverIdentity2 != null) { serverIdentity = serverIdentity2; } } } if (serverIdentity == null || serverIdentity.IsRemoteDisconnected()) { string uri2 = InternalSink.GetURI(msg); throw new RemotingException(Environment.GetResourceString("Remoting_Disconnected", new object[] { uri2 })); } return(serverIdentity); }
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg) { if (RemotingConfigHandler.Info == null) { return(true); } RuntimeType runtimeType = ctorMsg.ActivationType as RuntimeType; if (runtimeType == null) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } WellKnownClientTypeEntry wellKnownClientTypeEntry = RemotingConfigHandler.IsWellKnownClientType(runtimeType); string text = (wellKnownClientTypeEntry == null) ? null : wellKnownClientTypeEntry.ObjectUrl; if (text != null) { ctorMsg.Properties["Connect"] = text; return(false); } ActivatedClientTypeEntry activatedClientTypeEntry = RemotingConfigHandler.IsRemotelyActivatedClientType(runtimeType); string text2 = null; if (activatedClientTypeEntry == null) { object[] callSiteActivationAttributes = ctorMsg.CallSiteActivationAttributes; if (callSiteActivationAttributes != null) { for (int i = 0; i < callSiteActivationAttributes.Length; i++) { UrlAttribute urlAttribute = callSiteActivationAttributes[i] as UrlAttribute; if (urlAttribute != null) { text2 = urlAttribute.UrlValue; } } } if (text2 == null) { return(true); } } else { text2 = activatedClientTypeEntry.ApplicationUrl; } string value; if (!text2.EndsWith("/", StringComparison.Ordinal)) { value = text2 + "/RemoteActivationService.rem"; } else { value = text2 + "RemoteActivationService.rem"; } ctorMsg.Properties["Remote"] = value; return(false); }
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg) { if (RemotingConfigHandler.Info == null) { return(true); } RuntimeType svrType = ctorMsg.ActivationType as RuntimeType; if (svrType == (RuntimeType)null) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } WellKnownClientTypeEntry knownClientTypeEntry = RemotingConfigHandler.IsWellKnownClientType(svrType); string str1 = knownClientTypeEntry == null ? (string)null : knownClientTypeEntry.ObjectUrl; if (str1 != null) { ctorMsg.Properties[(object)"Connect"] = (object)str1; return(false); } ActivatedClientTypeEntry activatedClientTypeEntry = RemotingConfigHandler.IsRemotelyActivatedClientType(svrType); string str2 = (string)null; if (activatedClientTypeEntry == null) { object[] activationAttributes = ctorMsg.CallSiteActivationAttributes; if (activationAttributes != null) { for (int index = 0; index < activationAttributes.Length; ++index) { UrlAttribute urlAttribute = activationAttributes[index] as UrlAttribute; if (urlAttribute != null) { str2 = urlAttribute.UrlValue; } } } if (str2 == null) { return(true); } } else { str2 = activatedClientTypeEntry.ApplicationUrl; } string str3 = str2.EndsWith("/", StringComparison.Ordinal) ? str2 + "RemoteActivationService.rem" : str2 + "/RemoteActivationService.rem"; ctorMsg.Properties[(object)"Remote"] = (object)str3; return(false); }
public virtual IConstructionReturnMessage Activate(IConstructionCallMessage ctorMsg) { if ((ctorMsg == null) || RemotingServices.IsTransparentProxy(ctorMsg)) { throw new ArgumentNullException("ctorMsg"); } ctorMsg.Properties["Permission"] = "allowed"; if (!RemotingConfigHandler.IsActivationAllowed(ctorMsg.ActivationTypeName)) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_PermissionDenied"), new object[] { ctorMsg.ActivationTypeName })); } if (ctorMsg.ActivationType == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), new object[] { ctorMsg.ActivationTypeName })); } return(ActivationServices.GetActivator().Activate(ctorMsg)); }