コード例 #1
0
        public object Create(string appId, string appPath)
        {
            object obj2;

            try
            {
                if (appPath[0] == '.')
                {
                    FileInfo info = new FileInfo(appPath);
                    appPath = info.FullName;
                }
                if (!StringUtil.StringEndsWith(appPath, '\\'))
                {
                    appPath = appPath + @"\";
                }
                ISAPIApplicationHost appHost = new ISAPIApplicationHost(appId, appPath, false);
                ISAPIRuntime         o       = (ISAPIRuntime)this._appManager.CreateObjectInternal(appId, typeof(ISAPIRuntime), appHost, false, null);
                o.StartProcessing();
                obj2 = new ObjectHandle(o);
            }
            catch (Exception)
            {
                throw;
            }
            return(obj2);
        }
 public object Create(string appId, string appPath)
 {
     object obj2;
     try
     {
         if (appPath[0] == '.')
         {
             FileInfo info = new FileInfo(appPath);
             appPath = info.FullName;
         }
         if (!StringUtil.StringEndsWith(appPath, '\\'))
         {
             appPath = appPath + @"\";
         }
         ISAPIApplicationHost appHost = new ISAPIApplicationHost(appId, appPath, false);
         ISAPIRuntime o = (ISAPIRuntime) this._appManager.CreateObjectInternal(appId, typeof(ISAPIRuntime), appHost, false, null);
         o.StartProcessing();
         obj2 = new ObjectHandle(o);
     }
     catch (Exception)
     {
         throw;
     }
     return obj2;
 }
コード例 #3
0
        public Object Create(String appId, String appPath)
        {
            try {
                //
                //  Fill app a Dictionary with 'binding rules' -- name value string pairs
                //  for app domain creation
                //

                //


                if (appPath[0] == '.')
                {
                    System.IO.FileInfo file = new System.IO.FileInfo(appPath);
                    appPath = file.FullName;
                }

                if (!StringUtil.StringEndsWith(appPath, '\\'))
                {
                    appPath = appPath + "\\";
                }

                // Create new app domain via App Manager
#if FEATURE_PAL // FEATURE_PAL does not enable IIS-based hosting features
                throw new NotImplementedException("ROTORTODO");
#else // FEATURE_PAL
                ISAPIApplicationHost appHost = new ISAPIApplicationHost(appId, appPath, false /*validatePhysicalPath*/);

                ISAPIRuntime isapiRuntime = (ISAPIRuntime)_appManager.CreateObjectInternal(appId, typeof(ISAPIRuntime), appHost,
                                                                                           false /*failIfExists*/, null /*hostingParameters*/);


                isapiRuntime.StartProcessing();

                return(new ObjectHandle(isapiRuntime));
#endif // FEATURE_PAL
            }
            catch (Exception e) {
                Debug.Trace("internal", "AppDomainFactory::Create failed with " + e.GetType().FullName + ": " + e.Message + "\r\n" + e.StackTrace);
                throw;
            }
        }
コード例 #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
        private ISAPIApplicationHost CreateAppHost(string appId, string appPath) {

            //
            // if we have a null physical path, we need
            // to use the PMH to resolve it
            //
            if (String.IsNullOrEmpty(appPath)) {
                string virtualPath;
                string physicalPath;
                string siteName;
                string siteID;

                _functions.GetApplicationProperties(
                        appId,
                        out virtualPath,
                        out physicalPath,
                        out siteName,
                        out siteID);

                //
                // make sure physical app path ends with '\\' and virtual does not
                //
                if (!StringUtil.StringEndsWith(physicalPath, '\\')) {
                    physicalPath = physicalPath + "\\";
                }

                Debug.Assert( !String.IsNullOrEmpty(physicalPath), "!String.IsNullOrEmpty(physicalPath)");
                appPath = physicalPath;
            }

            //
            // Create a new application host
            // This needs to be a coherent type across all
            // protocol types so that we get a consistent
            // environment regardless of which protocol initializes first
            //
            ISAPIApplicationHost appHost = new
                ISAPIApplicationHost(
                        appId,
                        appPath,
                        false, /* validatePhysicalPath */
                        _functions
                        );


            return appHost;
        }
コード例 #6
0
        public Object Create(String appId, String appPath) {
            try {
                //
                //  Fill app a Dictionary with 'binding rules' -- name value string pairs
                //  for app domain creation
                //

                // 


                if (appPath[0] == '.') {
                    System.IO.FileInfo file = new System.IO.FileInfo(appPath);
                    appPath = file.FullName;
                }

                if (!StringUtil.StringEndsWith(appPath, '\\')) {
                    appPath = appPath + "\\";
                }

                // Create new app domain via App Manager
#if FEATURE_PAL // FEATURE_PAL does not enable IIS-based hosting features
                throw new NotImplementedException("ROTORTODO");
#else // FEATURE_PAL 

                ISAPIApplicationHost appHost = new ISAPIApplicationHost(appId, appPath, false /*validatePhysicalPath*/);

                ISAPIRuntime isapiRuntime = (ISAPIRuntime)_appManager.CreateObjectInternal(appId, typeof(ISAPIRuntime), appHost, 
                        false /*failIfExists*/, null /*hostingParameters*/);


                isapiRuntime.StartProcessing();

                return new ObjectHandle(isapiRuntime);
#endif // FEATURE_PAL 
            }
            catch (Exception e) {
                Debug.Trace("internal", "AppDomainFactory::Create failed with " + e.GetType().FullName + ": " + e.Message + "\r\n" + e.StackTrace);
                throw;
            }
        }
 internal IRegisteredObject CreateObjectWithDefaultAppHostAndAppId(string physicalPath, VirtualPath virtualPath, Type type, bool failIfExists, HostingEnvironmentParameters hostingParameters, out string appId)
 {
     IApplicationHost host;
     if (physicalPath == null)
     {
         HttpRuntime.ForceStaticInit();
         ISAPIApplicationHost host2 = new ISAPIApplicationHost(virtualPath.VirtualPathString, null, true, null, hostingParameters.IISExpressVersion);
         host = host2;
         appId = host2.AppId;
         virtualPath = VirtualPath.Create(host.GetVirtualPath());
         physicalPath = System.Web.Util.FileUtil.FixUpPhysicalDirectory(host.GetPhysicalPath());
     }
     else
     {
         appId = this.CreateSimpleAppID(virtualPath, physicalPath, null);
         host = new SimpleApplicationHost(virtualPath, physicalPath);
     }
     string precompilationTargetPhysicalDirectory = hostingParameters.PrecompilationTargetPhysicalDirectory;
     if (precompilationTargetPhysicalDirectory != null)
     {
         BuildManager.VerifyUnrelatedSourceAndDest(physicalPath, precompilationTargetPhysicalDirectory);
         if ((hostingParameters.ClientBuildManagerParameter != null) && ((hostingParameters.ClientBuildManagerParameter.PrecompilationFlags & PrecompilationFlags.Updatable) == PrecompilationFlags.Default))
         {
             appId = appId + "_precompile";
         }
         else
         {
             appId = appId + "_precompile_u";
         }
     }
     return this.CreateObjectInternal(appId, type, host, failIfExists, hostingParameters);
 }