internal static List <IISSites> ReadXmlFromConfig(IISExpressConfiguration iisExConfig) { _iisSites = new List <IISSites>(); if (!iisExConfig.CheckIISExpressConfigExistence()) { return(null); } string contents = File.ReadAllText(iisExConfig.IISExpressConfigAddress); var document = new XmlDocument(); document.LoadXml(contents); XmlNodeList siteList = document.GetElementsByTagName("site"); XmlNodeList bindingNodes = document.SelectNodes("/configuration/system.applicationHost/sites/site/bindings"); int counter = 0; foreach (object node in siteList) { var xmlElement = (XmlElement)node; var portNumber = FindPort(bindingNodes.Item(counter).InnerXml); _iisSites.Add(new IISSites(xmlElement.Attributes["name"].Value, xmlElement.Attributes["id"].Value, portNumber)); counter++; } return(_iisSites); }
public Form1() { InitializeComponent(); _iisExpressConfig = new IISExpressConfiguration(); SetStatusLabels(); ListViewPropertySetter(); ListViewCompleteReloadWithAssigningPID(); textBox1.Text = "Double click on any item to start it!"; }