Пример #1
0
 public void StopAppDomainProtocolListenerChannel(string appId, string protocolId, int listenerChannelId, bool immediate)
 {
     try
     {
         if (appId == null)
         {
             throw new ArgumentNullException("appId");
         }
         if (protocolId == null)
         {
             throw new ArgumentNullException("protocolId");
         }
         Type appDomainProtocolHandlerType = this.GetAppDomainProtocolHandlerType(protocolId);
         AppDomainProtocolHandler handler  = null;
         LockableAppDomainContext lockableAppDomainContext = this._appManager.GetLockableAppDomainContext(appId);
         lock (lockableAppDomainContext)
         {
             handler = (AppDomainProtocolHandler)this._appManager.GetObject(appId, appDomainProtocolHandlerType);
         }
         if (handler != null)
         {
             handler.StopListenerChannel(listenerChannelId, immediate);
         }
     }
     catch (Exception exception)
     {
         using (new ProcessImpersonationContext())
         {
             Misc.ReportUnhandledException(exception, new string[] { System.Web.SR.GetString("Failure_Stop_AppDomain_Listener") });
         }
         throw;
     }
 }
 internal void StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
 {
     IListenerChannelCallback listenerChannelCallback = this.MarshalComProxy(listenerCallback);
     if ((listenerChannelCallback != null) && (handler != null))
     {
         handler.StartListenerChannel(listenerChannelCallback);
     }
 }
        internal void StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
        {
            IListenerChannelCallback listenerChannelCallback = this.MarshalComProxy(listenerCallback);

            if ((listenerChannelCallback != null) && (handler != null))
            {
                handler.StartListenerChannel(listenerChannelCallback);
            }
        }
Пример #4
0
 public void StartAppDomainProtocolListenerChannel(string appId, string protocolId, IListenerChannelCallback listenerChannelCallback)
 {
     try
     {
         if (appId == null)
         {
             throw new ArgumentNullException("appId");
         }
         if (protocolId == null)
         {
             throw new ArgumentNullException("protocolId");
         }
         ISAPIApplicationHost appHostParameter             = this.CreateAppHost(appId, null);
         Type appDomainProtocolHandlerType                 = this.GetAppDomainProtocolHandlerType(protocolId);
         AppDomainProtocolHandler handler                  = null;
         LockableAppDomainContext lockableAppDomainContext = this._appManager.GetLockableAppDomainContext(appId);
         lock (lockableAppDomainContext)
         {
             HostingEnvironmentParameters hostingParameters = new HostingEnvironmentParameters {
                 HostingFlags = HostingEnvironmentFlags.ThrowHostingInitErrors
             };
             this.PreloadApplicationIfRequired(appId, appHostParameter, hostingParameters, lockableAppDomainContext);
             handler = (AppDomainProtocolHandler)this._appManager.CreateObjectInternal(appId, appDomainProtocolHandlerType, appHostParameter, false, hostingParameters);
             ListenerAdapterDispatchShim shim = (ListenerAdapterDispatchShim)this._appManager.CreateObjectInternal(appId, typeof(ListenerAdapterDispatchShim), appHostParameter, false, hostingParameters);
             if (shim == null)
             {
                 throw new HttpException(System.Web.SR.GetString("Failure_Create_Listener_Shim"));
             }
             shim.StartListenerChannel(handler, listenerChannelCallback);
             ((IRegisteredObject)shim).Stop(true);
         }
     }
     catch (Exception exception)
     {
         using (new ProcessImpersonationContext())
         {
             Misc.ReportUnhandledException(exception, new string[] { System.Web.SR.GetString("Failure_Start_AppDomain_Listener") });
         }
         throw;
     }
 }
Пример #5
0
        // this should run in an Hosted app domain (not in the default domain)
        internal void StartListenerChannel( AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback ) {
            Debug.Assert( HostingEnvironment.IsHosted, "HostingEnvironment.IsHosted" );
            Debug.Assert( null != handler, "null != handler" );

            IListenerChannelCallback unwrappedProxy = MarshalComProxy(listenerCallback);

            Debug.Assert(null != unwrappedProxy, "null != unwrappedProxy");
            if (null != unwrappedProxy && null != handler) {
                handler.StartListenerChannel(unwrappedProxy);
            }
        }