namespace InstallService
{

public delegate void MessageHandler( string msg );

public class ActBase
{

public ActBase() //생성자
{
}


#region *. 오류관련 처리 메세지 이벤트

public event MessageHandler MessageEvent;

public void FireMessageEvent( string msg )
{

if( MessageEvent == null ) return;
MessageEvent( msg );

}

#endregion

...

#region 5. WriteAppPool : 응용프로그램 풀의 추가 (XmlDocument를 이용)
/// <summary>
/// AppPool(응용프로그램 풀)의 추가
/// </summary>
public void WriteAppPool()
{

XmlDocument xdoc = new XmlDocument();
XmlDocument AddNode = new XmlDocument();
 
OrgXmlPath = Environment.SystemDirectory + "\\inetsrv\\Metabase.xml";
XmlPath  = Application.StartupPath + "\\XmlDoc\\AppPool.xml";
BackupPath = Application.StartupPath + "\\Metabase.xml";
strReturn = string.Empty;
condition = string.Empty;

try
{

//원본 파일을 공용폴더쪽에 백업한다.
File.Copy( OrgXmlPath, BackupPath, true );

//\WINDOWS\system32\inetsrv\Metabase.xml파일을 읽어와서 준비된 AppPool.xml파일의 내용을 추가한다.
xdoc.Load( OrgXmlPath );
AddNode.Load( XmlPath );
XmlNode ImportChild = xdoc.ImportNode( AddNode.DocumentElement.LastChild, true );
xdoc.DocumentElement.AppendChild( ImportChild );
xdoc.Save( OrgXmlPath );

}
catch(Exception ex)
{

condition = "e";
strReturn = "응용프로그램 풀을 등록하는 도중 다음과 같은 오류가 발생하였습니다.\n\n";
strReturn += ex.ToString();


StringBuilder sb = new StringBuilder();    
sb.Append("[ERROR]");
sb.Append(Environment.NewLine);
sb.Append("응용프로그램 풀을 등록하는 도중 다음과 같은 오류가 발생하였습니다.");
sb.Append(Environment.NewLine);
sb.Append(ex.Message);
sb.Append(Environment.NewLine);
sb.Append(ex.Source);
sb.Append(Environment.NewLine);
sb.Append(ex.StackTrace);
sb.Append(Environment.NewLine);
this.FireMessageEvent( sb.ToString());

}

}
#endregion

...

}//end Class

}//end namespace

+ Recent posts