public static IMessage Activate(RemotingProxy proxy, ConstructionCall ctorCall) { IMessage response; ctorCall.SourceProxy = proxy; if (Thread.CurrentContext.HasExitSinks && !ctorCall.IsContextOk) { response = Thread.CurrentContext.GetClientContextSinkChain().SyncProcessMessage(ctorCall); } else { response = RemoteActivate(ctorCall); } if (response is IConstructionReturnMessage && ((IConstructionReturnMessage)response).Exception == null && proxy.ObjectIdentity == null) { #if !DISABLE_REMOTING Identity identity = RemotingServices.GetMessageTargetIdentity(ctorCall); proxy.AttachIdentity(identity); #endif } return(response); }
internal static MarshalByRefObject CreateInstance(RuntimeType serverType) { MarshalByRefObject transparentProxy = null; ConstructorCallMessage ctorCallMsg = null; RemotingProxy realProxy; bool flag = IsCurrentContextOK(serverType, null, ref ctorCallMsg); if (flag && !serverType.IsContextful) { return(RemotingServices.AllocateUninitializedObject(serverType)); } transparentProxy = (MarshalByRefObject)ConnectIfNecessary(ctorCallMsg); if (transparentProxy == null) { realProxy = new RemotingProxy(serverType); transparentProxy = (MarshalByRefObject)realProxy.GetTransparentProxy(); } else { realProxy = (RemotingProxy)RemotingServices.GetRealProxy(transparentProxy); } realProxy.ConstructorMessage = ctorCallMsg; if (!flag) { ContextLevelActivator activator = new ContextLevelActivator { NextActivator = ctorCallMsg.Activator }; ctorCallMsg.Activator = activator; return(transparentProxy); } ctorCallMsg.ActivateInContext = true; return(transparentProxy); }
internal static IConstructionReturnMessage Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg) { IConstructionReturnMessage message = null; if (((ConstructorCallMessage)ctorMsg).ActivateInContext) { message = ctorMsg.Activator.Activate(ctorMsg); if (message.Exception != null) { throw message.Exception; } return(message); } GetPropertiesFromAttributes(ctorMsg, ctorMsg.CallSiteActivationAttributes); GetPropertiesFromAttributes(ctorMsg, ((ConstructorCallMessage)ctorMsg).GetWOMAttributes()); GetPropertiesFromAttributes(ctorMsg, ((ConstructorCallMessage)ctorMsg).GetTypeAttributes()); IMethodReturnMessage message2 = (IMethodReturnMessage)Thread.CurrentContext.GetClientContextChain().SyncProcessMessage(ctorMsg); message = message2 as IConstructionReturnMessage; if (message2 == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_Failed")); } if (message2.Exception != null) { throw message2.Exception; } return(message); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var proxy = new RemotingProxy(); services.AddTransient(sp => proxy.Create <IService1>(new Uri("fabric:/CorrelationId/CorrelationId.StatelessService1"))); services.AddTransient(sp => proxy.Create <IService2>(new Uri("fabric:/CorrelationId/CorrelationId.StatelessService2"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
internal static object CheckIfConnected(RemotingProxy proxy, IConstructionCallMessage ctorMsg) { string str = (string)ctorMsg.Properties["Connect"]; object transparentProxy = null; if (str != null) { transparentProxy = proxy.GetTransparentProxy(); } return(transparentProxy); }
internal static object CheckIfConnected(RemotingProxy proxy, IConstructionCallMessage ctorMsg) { string text = (string)ctorMsg.Properties["Connect"]; object result = null; if (text != null) { result = proxy.GetTransparentProxy(); } return(result); }
internal static IMessageSink GetChannelSinkForProxy(object obj) { IMessageSink messageSink = (IMessageSink)null; if (RemotingServices.IsTransparentProxy(obj)) { RemotingProxy remotingProxy = RemotingServices.GetRealProxy(obj) as RemotingProxy; if (remotingProxy != null) { messageSink = remotingProxy.IdentityObject.ChannelSink; } } return(messageSink); }
internal static object CreateClientProxyForContextBound(Type type, object[] activationAttributes) { if (type.IsContextful) { // Look for a ProxyAttribute ProxyAttribute att = (ProxyAttribute)Attribute.GetCustomAttribute(type, typeof(ProxyAttribute), true); if (att != null) { return(att.CreateInstance(type)); } } RemotingProxy proxy = new RemotingProxy(type, ChannelServices.CrossContextUrl, activationAttributes); return(proxy.GetTransparentProxy()); }
internal static IMessageSink GetChannelSinkForProxy(object obj) { IMessageSink result = null; if (RemotingServices.IsTransparentProxy(obj)) { RealProxy realProxy = RemotingServices.GetRealProxy(obj); RemotingProxy remotingProxy = realProxy as RemotingProxy; if (remotingProxy != null) { Identity identityObject = remotingProxy.IdentityObject; result = identityObject.ChannelSink; } } return(result); }
internal static object CreateClientProxy(Type objectType, string url, object[] activationAttributes) { string activationUrl = url; if (!activationUrl.EndsWith("/")) { activationUrl += "/"; } activationUrl += "RemoteActivationService.rem"; string objectUri; GetClientChannelSinkChain(activationUrl, null, out objectUri); RemotingProxy proxy = new RemotingProxy(objectType, activationUrl, activationAttributes); return(proxy.GetTransparentProxy()); }
// Find the channel message sink associated with a given proxy internal static IMessageSink GetChannelSinkForProxy(Object obj) { IMessageSink sink = null; if (RemotingServices.IsTransparentProxy(obj)) { RealProxy rp = RemotingServices.GetRealProxy(obj); RemotingProxy remProxy = rp as RemotingProxy; if (null != remProxy) { Identity idObj = remProxy.IdentityObject; BCLDebug.Assert(null != idObj, "null != idObj"); sink = idObj.ChannelSink; } } return(sink); } // GetChannelSinkForProxy
public static IMessage Activate(RemotingProxy proxy, ConstructionCall ctorCall) { ctorCall.SourceProxy = proxy; IMessage message; if (Thread.CurrentContext.HasExitSinks && !ctorCall.IsContextOk) { message = Thread.CurrentContext.GetClientContextSinkChain().SyncProcessMessage(ctorCall); } else { message = ActivationServices.RemoteActivate(ctorCall); } if (message is IConstructionReturnMessage && ((IConstructionReturnMessage)message).Exception == null && proxy.ObjectIdentity == null) { Identity messageTargetIdentity = RemotingServices.GetMessageTargetIdentity(ctorCall); proxy.AttachIdentity(messageTargetIdentity); } return(message); }
internal static MarshalByRefObject CreateInstance(RuntimeType serverType) { ConstructorCallMessage ctorCallMsg = (ConstructorCallMessage)null; bool flag = ActivationServices.IsCurrentContextOK(serverType, (object[])null, ref ctorCallMsg); MarshalByRefObject marshalByRefObject; if (flag && !serverType.IsContextful) { marshalByRefObject = RemotingServices.AllocateUninitializedObject(serverType); } else { marshalByRefObject = (MarshalByRefObject)ActivationServices.ConnectIfNecessary((IConstructionCallMessage)ctorCallMsg); RemotingProxy remotingProxy; if (marshalByRefObject == null) { remotingProxy = new RemotingProxy((Type)serverType); marshalByRefObject = (MarshalByRefObject)remotingProxy.GetTransparentProxy(); } else { remotingProxy = (RemotingProxy)RemotingServices.GetRealProxy((object)marshalByRefObject); } remotingProxy.ConstructorMessage = ctorCallMsg; if (!flag) { ctorCallMsg.Activator = (IActivator) new ContextLevelActivator() { NextActivator = ctorCallMsg.Activator } } ; else { ctorCallMsg.ActivateInContext = true; } } return(marshalByRefObject); }
internal static IConstructionReturnMessage Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg) { IConstructionReturnMessage constructionReturnMessage; if (((ConstructorCallMessage)ctorMsg).ActivateInContext) { constructionReturnMessage = ctorMsg.Activator.Activate(ctorMsg); if (constructionReturnMessage.Exception != null) { throw constructionReturnMessage.Exception; } } else { IConstructionCallMessage ctorMsg1 = ctorMsg; object[] activationAttributes = ctorMsg1.CallSiteActivationAttributes; ActivationServices.GetPropertiesFromAttributes(ctorMsg1, activationAttributes); IConstructionCallMessage ctorMsg2; object[] womAttributes = ((ConstructorCallMessage)(ctorMsg2 = ctorMsg)).GetWOMAttributes(); ActivationServices.GetPropertiesFromAttributes(ctorMsg2, womAttributes); IConstructionCallMessage ctorMsg3; object[] typeAttributes = ((ConstructorCallMessage)(ctorMsg3 = ctorMsg)).GetTypeAttributes(); ActivationServices.GetPropertiesFromAttributes(ctorMsg3, typeAttributes); IMethodReturnMessage methodReturnMessage = (IMethodReturnMessage)Thread.CurrentContext.GetClientContextChain().SyncProcessMessage((IMessage)ctorMsg); constructionReturnMessage = methodReturnMessage as IConstructionReturnMessage; if (methodReturnMessage == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_Failed")); } if (methodReturnMessage.Exception != null) { throw methodReturnMessage.Exception; } } return(constructionReturnMessage); }
public static RemotingProxy GetRealProxy(object transparentProxy) { RemotingProxy rp = (RemotingProxy)RemotingServices.GetRealProxy(transparentProxy); return(rp); }
internal static ClientIdentity GetOrCreateClientIdentity(ObjRef objRef, Type proxyType, out object clientProxy) { // This method looks for an identity for the given url. // If an identity is not found, it creates the identity and // assigns it a proxy to the remote object. // Creates the client sink chain for the given url or channelData. // It will also get the object uri from the url. object channelData = objRef.ChannelInfo != null ? objRef.ChannelInfo.ChannelData : null; string objectUri; IMessageSink sink = GetClientChannelSinkChain(objRef.URI, channelData, out objectUri); if (objectUri == null) { objectUri = objRef.URI; } lock (uri_hash) { clientProxy = null; string uri = GetNormalizedUri(objRef.URI); ClientIdentity identity = uri_hash [uri] as ClientIdentity; if (identity != null) { // Object already registered clientProxy = identity.ClientProxy; if (clientProxy != null) { return(identity); } // The proxy has just been GCed, so its identity cannot // be reused. Just dispose it. DisposeIdentity(identity); } // Creates an identity and a proxy for the remote object identity = new ClientIdentity(objectUri, objRef); identity.ChannelSink = sink; // Registers the identity uri_hash [uri] = identity; if (proxyType != null) { RemotingProxy proxy = new RemotingProxy(proxyType, identity); CrossAppDomainSink cds = sink as CrossAppDomainSink; if (cds != null) { proxy.SetTargetDomain(cds.TargetDomainId); } clientProxy = proxy.GetTransparentProxy(); identity.ClientProxy = (MarshalByRefObject)clientProxy; } return(identity); } }
public void Process(RemotingProxy proxy) { Detected = true; }