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
            
{
            }


        }

    }

}

posted on 2006-08-29 09:21  Liangyy  阅读(324)  评论(0编辑  收藏  举报