Beispiel #1
0
 public void StopWebServer(IISWebServer ws)
 {
     StopWebServer(ws.ID);
 }
Beispiel #2
0
 public ServerState WebServerStatus(IISWebServer ws)
 {
     return
         (ServerState)
         new DirectoryEntry(String.Concat("IIS://localhost/W3SVC/", ws.ID)).Properties["ServerState"][0];
 }
Beispiel #3
0
 public IISWebServerCollection GetWebServers()
 {
     var iISWebServerCollection = new IISWebServerCollection();
     IEnumerator iEnumerator1 = new DirectoryEntry("IIS://localhost/W3SVC").Children.GetEnumerator();
     try
     {
         while (iEnumerator1.MoveNext())
         {
             var directoryEntry2 = (DirectoryEntry) iEnumerator1.Current;
             if (directoryEntry2.SchemaClassName != "IIsWebServer") continue;
             var iISWebServer = new IISWebServer
                                    {
                                        iID = Convert.ToInt32(directoryEntry2.Name),
                                        sServerName =
                                            (String) directoryEntry2.Properties["ServerComment"].Value
                                    };
             var directoryEntry3 =
                 new DirectoryEntry(String.Concat("IIS://localhost/W3SVC/", iISWebServer.ID, "/Root"));
             iISWebServer.sRootPath = directoryEntry3.Properties["Path"][0] as String;
             IEnumerator iEnumerator2 = directoryEntry3.Children.GetEnumerator();
             try
             {
                 while (iEnumerator2.MoveNext())
                 {
                     var directoryEntry4 = (DirectoryEntry) iEnumerator2.Current;
                     if (directoryEntry4.SchemaClassName.ToUpper() == "IIsWebVirtualDir".ToUpper())
                     {
                         var iISWebVirtualDirectory = new IISWebVirtualDirectory
                                                          {
                                                              _sPath =
                                                                  (String) directoryEntry4.Properties["Path"][0],
                                                              _sName = directoryEntry4.Name,
                                                              _isApplication =
                                                                  (String)
                                                                  directoryEntry4.Properties["AppRoot"][0] !=
                                                                  String.Concat("/LM/W3SVC/", iISWebServer.ID,
                                                                                "/ROOT"),
                                                              _iWebServerID = iISWebServer.ID
                                                          };
                         iISWebServer.VirtualDirectories.Add(iISWebVirtualDirectory);
                     }
                 }
             }
             finally
             {
                 var iDisposable = iEnumerator2 as IDisposable;
                 if (iDisposable != null)
                 {
                     iDisposable.Dispose();
                 }
             }
             iISWebServerCollection.Add(iISWebServer);
         }
     }
     finally
     {
         var iDisposable = iEnumerator1 as IDisposable;
         if (iDisposable != null)
         {
             iDisposable.Dispose();
         }
     }
     return iISWebServerCollection;
 }
Beispiel #4
0
 public void PauseWebServer(IISWebServer ws)
 {
     PauseWebServer(ws.ID);
 }
Beispiel #5
0
 public void DeleteWebSiteApplication(IISWebServer ws, string sVirtualDirectoryName)
 {
     DeleteWebSiteApplication(ws.ID, sVirtualDirectoryName);
 }
Beispiel #6
0
        public IISWebServer GetWebServer(string sWerServerName)
        {
            DirectoryEntry directoryEntry3;

            IISWebServer iISWebServer = null;
            IEnumerator iEnumerator1 = new DirectoryEntry("IIS://localhost/W3SVC").Children.GetEnumerator();
            try
            {
                while (iEnumerator1.MoveNext())
                {
                    var directoryEntry2 = (DirectoryEntry) iEnumerator1.Current;
                    if (directoryEntry2.SchemaClassName == "IIsWebServer" &&
                        ((String) directoryEntry2.Properties["ServerComment"].Value).Equals(sWerServerName))
                    {
                        iISWebServer = new IISWebServer
                                           {
                                               iID = Convert.ToInt32(directoryEntry2.Name),
                                               sServerName = (String) directoryEntry2.Properties["ServerComment"].Value
                                           };
                        directoryEntry3 =
                            new DirectoryEntry(String.Concat("IIS://localhost/W3SVC/", iISWebServer.ID, "/Root"));
                        iISWebServer.sRootPath = directoryEntry3.Properties["Path"][0] as String;
                        var iEnumerator2 = directoryEntry3.Children.GetEnumerator();
                        try
                        {
                            while (iEnumerator2.MoveNext())
                            {
                                var directoryEntry4 = (DirectoryEntry) iEnumerator2.Current;
                                if (directoryEntry4.SchemaClassName.ToUpper() != "IIsWebVirtualDir".ToUpper()) continue;
                                var iISWebVirtualDirectory = new IISWebVirtualDirectory
                                                                 {
                                                                     _sPath =
                                                                         (String)
                                                                         directoryEntry4.Properties["Path"][0],
                                                                     _sName = directoryEntry4.Name,
                                                                     _isApplication =
                                                                         (String)
                                                                         directoryEntry4.Properties["AppRoot"][0] !=
                                                                         String.Concat("/LM/W3SVC/", iISWebServer.ID,
                                                                                       "/ROOT"),
                                                                     _iWebServerID = iISWebServer.ID
                                                                 };
                                AddWebDirectories(directoryEntry4, String.Concat("/", iISWebVirtualDirectory._sName),
                                                  iISWebVirtualDirectory.WebDirectories, iISWebServer.ID,
                                                  iISWebVirtualDirectory._sPath);
                                iISWebServer.VirtualDirectories.Add(iISWebVirtualDirectory);
                            }
                        }
                        finally
                        {
                            var iDisposable = iEnumerator2 as IDisposable;
                            if (iDisposable != null)
                            {
                                iDisposable.Dispose();
                            }
                        }
                        AddWebDirectories(directoryEntry3, "", iISWebServer.WebDirectories, iISWebServer.ID,
                                          iISWebServer.RootPath);
                        directoryEntry3.Dispose();
                        break;
                    }
                }
            }
            finally
            {
                var iDisposable = iEnumerator1 as IDisposable;
                if (iDisposable != null)
                {
                    iDisposable.Dispose();
                }
            }
            return iISWebServer;
        }
Beispiel #7
0
 public void DeleteWebServer(IISWebServer ws)
 {
     DeleteWebServer(ws.ID);
 }
Beispiel #8
0
 public void DeleteWebServerVirtualDirectory(IISWebServer ws, string sVirtualDirectoryName)
 {
     DeleteWebServerVirtualDirectory(ws.ID, sVirtualDirectoryName);
 }
Beispiel #9
0
 public void CreateWebServerVirtualDirectory(IISWebServer ws, string sVirtualDirectoryName, string sPath,
                                             bool isApplication)
 {
     CreateWebServerVirtualDirectory(ws.ID, sVirtualDirectoryName, sPath, isApplication, false);
 }
Beispiel #10
0
 public void CreateWebSiteApplication(IISWebServer ws, string sVirtualDirectoryName)
 {
     CreateWebSiteApplication(ws.ID, sVirtualDirectoryName, false);
 }
 public void Remove(IISWebServer value)
 {
     List.Remove(value);
 }
 public void Insert(int index, IISWebServer value)
 {
     List.Insert(index, value);
 }
 public int IndexOf(IISWebServer value)
 {
     return List.IndexOf(value);
 }
 public bool Contains(IISWebServer value)
 {
     return List.Contains(value);
 }
 public int Add(IISWebServer value)
 {
     return List.Add(value);
 }