本帖最后由 hwhtj 于 2012-02-02 11:20:59 编辑

解决方案 »

  1.   

     public override void Uninstall(System.Collections.IDictionary savedState)
            {
     System.Diagnostics.Debugger.Launch ();
                base.Uninstall(savedState);
                //卸载时删除虚拟目录,有问题
                System.DirectoryServices.DirectoryEntry dirroot = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
                StringBuilder sb = new StringBuilder();
                sb.Append(GetCurrentDomainPath());
                string sbb = sb.ToString();
                MessageBox.Show(sbb);
                string sweb = System.Web.HttpContext.Current.Server.MapPath("/");
                MessageBox.Show(sweb + sbb);
                DirectoryEntry Dirport = dirroot.Children.Find(sweb, sbb);
                Dirport.Invoke("AppDelete", true);
                dirroot.CommitChanges();
    ……………………单步调试一下: