Classsetup.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
namespace Classsetup
{
    [RunInstaller(true)]
    public class Classsetup : System.Configuration.Install.Installer
    {
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            try
            {
                Process[] ASPNET_Proc = Process.GetProcessesByName("aspnet_wp");
                for(short i = 0; i < ASPNET_Proc.GetLength(0); i++)
                {
                    //ASPNET_Proc[i].Close();
                    ASPNET_Proc[i].Kill();
                    ASPNET_Proc[i] = null;
                }
            }
            catch
            {
            }
            try
            {
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\aspnet_state", "Start", 2);
                Process MyProcess = new Process();
                MyProcess.StartInfo.FileName = "NET";
                MyProcess.StartInfo.Arguments = "Start ASPNET_STATE";
                MyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                MyProcess.StartInfo.CreateNoWindow = true;
                MyProcess.Start();
                MyProcess.WaitForExit();
                MyProcess.Close();
                MyProcess = null;
            }
            catch
            {
            }
        }
    }
}
                    
                


    
                
            
        
浙公网安备 33010602011771号