Пример #1
0
        /// <summary>
        /// Starts the ASP.Net runtime hosting by creating a new appdomain and loading the runtime into it.
        /// </summary>
        /// <returns>true or false</returns>
        public bool Start()
        {
            if (this.Proxy == null)
            {
                // *** Make sure ASP.Net registry keys exist
                // *** if IIS was never registered, required aspnet_isapi.dll
                // *** cannot be found otherwise
                this.GetInstallPathAndConfigureAspNetIfNeeded();

                if (this.VirtualPath.Length == 0 || this.PhysicalDirectory.Length == 0)
                {
                    this.ErrorMessage = "Virtual or Physical Path not set.";
                    this.Error = true;
                    return false;
                }

                // *** Force any assemblies assemblies to be copied
                this.MakeShadowCopies(this.ShadowCopyAssemblies);

                try
                {
                    this.Proxy = wwAspRuntimeProxy.Start(this.PhysicalDirectory, this.VirtualPath,
                        this.ApplicationBase, this.ConfigFile);

                    this.Proxy.PhysicalDirectory = this.PhysicalDirectory;
                    this.Proxy.VirtualPath = this.VirtualPath;

                }
                catch (Exception ex)
                {
                    this.ErrorMessage = ex.Message;
                    this.Error = true;
                    this.Proxy = null;
                    return false;
                }
                this.Cookies.Clear();
            }

            return true;
        }
Пример #2
0
 /// <summary>
 /// Stops the ASP.Net runtime unloading the AppDomain
 /// </summary>
 /// <returns></returns>
 public bool Stop()
 {
     if (this.Proxy != null)
     {
         try
         {
             wwAspRuntimeProxy.Stop(this.Proxy);
             this.Proxy = null;
         }
         catch (Exception ex)
         {
             this.ErrorMessage = ex.Message;
             this.Error = true;
             return false;
         }
         return true;
     }
     return false;
 }
Пример #3
0
        /// <summary>
        /// Unloads the runtime host by unloading the AppDomain. Use this to free memory if you are compiling lots of pages or recycle the host.
        /// </summary>
        /// <param name="Host">The host.</param>
        public static void Stop(wwAspRuntimeProxy Host)
        {
            if (Host != null)
            {
                Host.Context.Clear();
                Host.Context = null;

                Host.UnloadRuntime();

                AppDomain.Unload(Host.AppDomain);
                Host = null;
            }
        }