Compartir a través de


Administración de <management>

Información general

El elemento <management> especifica la configuración de administración remota para los usuarios que se conectan al servidor mediante el administrador de IIS. El elemento <management> contiene tres elementos secundarios:

  • <authentication>: este elemento secundario contiene una lista de proveedores de autenticación en un elemento <providers> y puede contener los nombres de usuario y las contraseñas de las cuentas de usuario del administrador de IIS si usa el ConfigurationAuthenticationProvider predeterminado como proveedor de autenticación.
  • <authorization>: este elemento secundario contiene una lista de proveedores de autorización en un elemento <providers> y puede contener las reglas de autorización para las cuentas de usuario si usa el ConfigurationAuthorizationProvider predeterminado como proveedor de autorización.
  • <trustedProviders>: este elemento secundario contiene una lista de los proveedores de administración que confía el administrador de IIS y el servicio de administración (WMSVC).

Nota:

La configuración del elemento <management> solo se puede configurar en el archivo Administration.config.

Compatibilidad

Versión Notas
IIS 10.0 El elemento <management> no se modificó en IIS 10.0.
IIS 8.5 El elemento <management> no se modificó en IIS 8.5.
IIS 8.0 El elemento <management> no se modificó en IIS 8.0.
IIS 7.5 El elemento <management> no se modificó en IIS 7.5.
IIS 7.0 El elemento <management> se introdujo en IIS 7.0.
IIS 6,0 N/D

Configuración

La instalación predeterminada de IIS 7 y versiones posteriores no incluye el servicio de rol de Servicio de administración. Para instalar este servicio de rol, siga estos pasos.

Windows Server 2012 o Windows Server 2012 R2

  1. En la barra de tareas, haga clic en Administrador del servidor.
  2. En Administrador del servidor, haga clic en Administrar y, después, haga clic en Agregar roles y características.
  3. En el asistente para Agregar roles y características, haga clic en Siguiente. Seleccione el tipo de instalación y haga clic en Siguiente. Seleccione el servidor de destino y haga clic en Siguiente.
  4. En la página Roles de servidor, expanda Servidor web (IIS), expanda Herramientas de administración y, a continuación, seleccione Servicio de administración. Haga clic en Next.
    Screenshot of the Management Service option being highlighted and selected. .
  5. En la página Seleccionar características, haz clic en Siguiente.
  6. En la página Confirmar selecciones de instalación, haga clic en Instalar.
  7. En la página Resultados , haga clic en Cerrar.

Windows 8 o Windows 8.1

  1. En la pantalla Inicio, mueva el puntero hasta la esquina inferior izquierda, haga clic con el botón derecho en el botón Inicio y, a continuación, haga clic en Panel de control.
  2. En Panel de control, haga clic en Programas y características y después en Activar o desactivar las características de Windows.
  3. Expanda Internet Information Services, expanda Herramientas de administración web y seleccione Servicio de administración de IIS.
    Screenshot of the I I S Management Service folder being highlighted and selected.
  4. Haga clic en OK.
  5. Haga clic en Cerrar.

Windows Server 2008 o Windows Server 2008 R2

  1. En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, luego, haga clic en Administrador del servidor.
  2. En el panel de jerarquía del Administrador del servidor, expanda Roles y, luego, haga clic en Servidor web (IIS).
  3. En el panel Servidor web (IIS), desplácese hasta la sección Servicios de rol y, luego, haga clic en Agregar servicios de rol.
  4. En la página Seleccionar servicios de rol del Asistente para agregar servicios de rol, seleccione Servicio de administración y haga clic en Siguiente.
    Screenshot of the Select Role Services page showing the Management Service option being highlighted and selected.
  5. En la página Confirmar selecciones de instalación, haz clic en Instalar.
  6. En la página Resultados , haga clic en Cerrar.

Windows Vista o Windows 7

  1. En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
  2. En Panel de control, haga clic en Programas y características y después en Activar o desactivar las características de Windows.
  3. Expanda Internet Information Servicesy, a continuación , Herramienta de administración web.
  4. Seleccione Servicio de administración de IIS y, a continuación, haga clic en Aceptar.
    Screenshot of the Management Service screen.

Procedimientos

Habilitación de las credenciales del administrador de IIS para un servidor

  1. Abra el Administrador de Internet Information Services (IIS):

    • Si usa Windows Server 2012 o Windows Server 2012 R2:

      • En la barra de tareas, haga clic en Administrador del servidor, en Herramientas y, a continuación, en Administrador de Internet Information Services (IIS).
    • Si usa Windows 8 o Windows 8.1:

      • Mantenga presionada la tecla Windows, presione la letra X y haga clic en Panel de control.
      • En Panel de control, haga clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Server 2008 o Windows Server 2008 R2:

      • En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, a continuación, haga clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Vista o Windows 7:

      • En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
      • Haga doble clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
  2. En el panel Conexiones, haga clic en el nombre del servidor.

  3. En el panel Inicio del servidor, haga doble clic en Servicio de administración.
    Screenshot of the Server Home screen with a focus on the Management Service option.

  4. En la página Servicio de administración, elija credenciales de Windows o credenciales del administrador de IIS y, a continuación, haga clic en Aplicar en el panel Acciones.
    Screenshot of Management Service page showing the Apply option in the Actions pane.

Adición de credenciales de usuario del administrador de IIS a un servidor

  1. Abra el Administrador de Internet Information Services (IIS):

    • Si usa Windows Server 2012 o Windows Server 2012 R2:

      • En la barra de tareas, haga clic en Administrador del servidor, en Herramientas y, a continuación, en Administrador de Internet Information Services (IIS).
    • Si usa Windows 8 o Windows 8.1:

      • Mantenga presionada la tecla Windows, presione la letra X y haga clic en Panel de control.
      • En Panel de control, haga clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Server 2008 o Windows Server 2008 R2:

      • En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, a continuación, haga clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Vista o Windows 7:

      • En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
      • Haga doble clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
  2. En el panel Conexiones, haga clic en el nombre del servidor.

  3. En el panel Inicio del servidor, haga doble clic en Usuarios del administrador de IIS.
    Screenshot of the Server Home pane with the I I S Manager Users option being highlighted.

  4. En la página Usuarios del administrador de IIS, haga clic en Agregar usuario... en el panel Acciones.
    Screenshot of the I I S Manager Users page, showing the Add User option in the Actions pane.

  5. En el cuadro de diálogo Agregar usuario, escriba el nombre de usuario y la contraseña y, a continuación, haga clic en Aceptar.
    Screenshot of the Add User dialog box, showing the User name, Password, and Confirm password fields.

Cómo autorizar a un usuario del administrador de IIS para un sitio o aplicación

  1. Abra el Administrador de Internet Information Services (IIS):

    • Si usa Windows Server 2012 o Windows Server 2012 R2:

      • En la barra de tareas, haga clic en Administrador del servidor, en Herramientas y, a continuación, en Administrador de Internet Information Services (IIS).
    • Si usa Windows 8 o Windows 8.1:

      • Mantenga presionada la tecla Windows, presione la letra X y haga clic en Panel de control.
      • En Panel de control, haga clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Server 2008 o Windows Server 2008 R2:

      • En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, a continuación, haga clic en Administrador de Internet Information Services (IIS).
    • Si usa Windows Vista o Windows 7:

      • En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
      • Haga doble clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
  2. En el panel Conexiones, vaya a la conexión, el sitio, la aplicación o el directorio para el que desea autorizar a un usuario del administrador de IIS.

  3. En el panel Inicio, haga doble clic en Permisos del administrador de IIS.
    Screenshot of the Default Web Site Home page with the I I S Manager Permissions option being highlighted.

  4. En la página Permisos del administrador de IIS, haga clic en Permitir usuario... en el panel Acciones.
    Screenshot of the I I S Manager Permissions screen showing the Allow User option in the Actions pane.

  5. En el cuadro de diálogo Permitir usuario, elija Administrador de IIS y, a continuación, haga clic en Seleccionar...
    Screenshot of the Allow User dialog box with the I I S Manager option being selected.

  6. En el cuadro de diálogo Usuarios, resalte la cuenta de usuario que desea permitir y, a continuación, haga clic en Aceptar.
    Screenshot of the Users dialog box, showing the O K option.

  7. En el cuadro de diálogo Permitir usuario, haga clic en Aceptar.
    Screenshot of the Allow User dialog box, showing the O K option.

Configuración

Atributos

Ninguno.

Elementos secundarios

Elemento Descripción
authentication Elemento opcional.

Configura las opciones de autenticación para la administración remota del servidor web.
authorization Elemento opcional.

Configura las opciones de autorización para la administración remota del servidor web.
trustedProviders Elemento opcional.

Configura los proveedores de confianza del administrador de IIS y el servicio de administración (WMSVC).

Ejemplo de configuración

El siguiente elemento predeterminado <management> se configura en el archivo Administration.config de IIS 7 cuando se instala el servicio de rol servicio de administración.

<management>
   <authentication defaultProvider="ConfigurationAuthenticationProvider">
      <providers>
         <add name="ConfigurationAuthenticationProvider"
            type="Microsoft.Web.Management.Server.ConfigurationAuthenticationProvider, Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </providers>
   </authentication>
   <authorization defaultProvider="ConfigurationAuthorizationProvider">
      <providers>
         <add name="ConfigurationAuthorizationProvider"
            type="Microsoft.Web.Management.Server.ConfigurationAuthorizationProvider, Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </providers>
   </authorization>
   <trustedProviders allowUntrustedProviders="false">
      <add type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <add type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <add type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   </trustedProviders>
</management>

En el siguiente ejemplo de configuración se muestra cómo agregar un usuario del administrador de IIS denominado ContosoUser a Administration.config.

<credentials>
   <add name="ContosoUser" password="Encrypted-Password-Data" enabled="true" />
</credentials>

En el siguiente ejemplo de configuración se muestra cómo autorizar a un usuario del administrador de IIS denominado Contoso, un grupo de Windows denominado Grupo de pruebas y un usuario de Windows denominado Contoso2 para conectarse al sitio web predeterminado mediante el administrador de IIS.

<authorizationRules>
   <scope path="/Default Web Site">
      <add name="Contoso" />
      <add name="COMPUTER01\Test Group" isRole="true" />
      <add name="COMPUTER01\Contoso2" />
   </scope>
</authorizationRules>

Código de ejemplo

En los siguientes ejemplos de código se agrega una cuenta de usuario de IIS Manager denominada ContosoUser a IIS 7.

AppCmd.exe

Nota:

No se pueden configurar las opciones de <system.webServer/management/authentication> mediante AppCmd.exe.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetAdministrationConfiguration();

         ConfigurationSection authenticationSection = config.GetSection("system.webServer/management/authentication");
         ConfigurationElementCollection credentialsCollection = authenticationSection.GetCollection("credentials");
         ConfigurationElement addElement = credentialsCollection.CreateElement("add");
         addElement["name"] = @"ContosoUser";
         addElement["password"] = @"P@ssw0rd";
         addElement["enabled"] = true;
         credentialsCollection.Add(addElement);

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetAdministrationConfiguration

      Dim authenticationSection As ConfigurationSection = config.GetSection("system.webServer/management/authentication")
      Dim credentialsCollection As ConfigurationElementCollection = authenticationSection.GetCollection("credentials")
      Dim addElement As ConfigurationElement = credentialsCollection.CreateElement("add")
      addElement("name") = "ContosoUser"
      addElement("password") = "P@ssw0rd"
      credentialsCollection.Add(addElement)
      addElement("enabled") = True
      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager"); 
adminManager.CommitPath = "MACHINE/WEBROOT"; 
adminManager.SetMetadata("pathMapper", "AdministrationConfig");

var authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT"); 
var credentialsCollection = authenticationSection.ChildElements.Item("credentials").Collection;

var addElement = credentialsCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "ContosoUser";
addElement.Properties.Item("password").Value = "P@ssw0rd";
addElement.Properties.Item("enabled").Value = true;
credentialsCollection.AddElement(addElement);

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT"
adminManager.SetMetadata "pathMapper", "AdministrationConfig"

Set authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT")
Set credentialsCollection = authenticationSection.ChildElements.Item("credentials").Collection

Set addElement = credentialsCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "ContosoUser"
addElement.Properties.Item("password").Value = "P@ssw0rd"
addElement.Properties.Item("enabled").Value = True
credentialsCollection.AddElement(addElement)

adminManager.CommitChanges()

Los siguientes ejemplos de código comprueban si ya se ha agregado un elemento <scope> al elemento <authorizationRules> del sitio web predeterminado; si no es así, se agrega un elemento <scope> al elemento <authorizationRules>. A continuación, se agrega un elemento <add> al elemento <scope> que autoriza una cuenta de usuario denominada ContosoUser.

AppCmd.exe

Nota:

No se pueden configurar las opciones de <system.webServer/management/authorization> mediante AppCmd.exe.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetAdministrationConfiguration();
         ConfigurationSection authorizationSection = config.GetSection("system.webServer/management/authorization");
         ConfigurationElementCollection authorizationRulesCollection = authorizationSection.GetCollection("authorizationRules");

         ConfigurationElement scopeElement = FindElement(authorizationRulesCollection, "scope", "path", @"/Default Web Site");
         if (scopeElement == null)
         {
            scopeElement = authorizationRulesCollection.CreateElement("scope");
            scopeElement["path"] = @"/Default Web Site";
            authorizationRulesCollection.Add(scopeElement);
         }

         ConfigurationElementCollection scopeCollection = scopeElement.GetCollection();
         ConfigurationElement addElement = scopeCollection.CreateElement("add");
         addElement["name"] = @"ContosoUser";
         scopeCollection.Add(addElement);

         serverManager.CommitChanges();
      }
   }

   private static ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string[] keyValues)
   {
      foreach (ConfigurationElement element in collection)
      {
         if (String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase))
         {
            bool matches = true;
            for (int i = 0; i < keyValues.Length; i += 2)
            {
               object o = element.GetAttributeValue(keyValues[i]);
               string value = null;
               if (o != null)
               {
                  value = o.ToString();
               }
               if (!String.Equals(value, keyValues[i + 1], StringComparison.OrdinalIgnoreCase))
               {
                  matches = false;
                  break;
               }
            }
            if (matches)
            {
               return element;
            }
         }
      }
      return null;
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample
   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetAdministrationConfiguration
      Dim authorizationSection As ConfigurationSection = config.GetSection("system.webServer/management/authorization")
      Dim authorizationRulesCollection As ConfigurationElementCollection = authorizationSection.GetCollection("authorizationRules")

      Dim scopeElement As ConfigurationElement = FindElement(authorizationRulesCollection, "scope", "path", "/Default Web Site")
      If (scopeElement Is Nothing) Then
         scopeElement = authorizationRulesCollection.CreateElement("scope")
         scopeElement("path") = "/Default Web Site"
         authorizationRulesCollection.Add(scopeElement)
      End If

      Dim scopeCollection As ConfigurationElementCollection = scopeElement.GetCollection
      Dim addElement As ConfigurationElement = scopeCollection.CreateElement("add")
      addElement("name") = "ContosoUser"
      scopeCollection.Add(addElement)

      serverManager.CommitChanges()
   End Sub

   Private Function FindElement(ByVal collection As ConfigurationElementCollection, ByVal elementTagName As String, ByVal ParamArray keyValues() As String) As ConfigurationElement
      For Each element As ConfigurationElement In collection
         If String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase) Then
            Dim matches As Boolean = True
            Dim i As Integer
            For i = 0 To keyValues.Length - 1 Step 2
               Dim o As Object = element.GetAttributeValue(keyValues(i))
               Dim value As String = Nothing
               If (Not (o) Is Nothing) Then
                  value = o.ToString
               End If
               If Not String.Equals(value, keyValues((i + 1)), StringComparison.OrdinalIgnoreCase) Then
                  matches = False
                  Exit For
               End If
            Next
            If matches Then
               Return element
            End If
         End If
      Next
      Return Nothing
   End Function


End Module

JavaScript

var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager"); 
adminManager.CommitPath = "MACHINE/WEBROOT"; 
adminManager.SetMetadata("pathMapper", "AdministrationConfig");

var authorizationSection = adminManager.GetAdminSection("system.webServer/management/authorization", "MACHINE/WEBROOT"); 
var authorizationRulesCollection = authorizationSection.ChildElements.Item("authorizationRules").Collection;

var scopeElementPos = FindElement(authorizationRulesCollection, "scope", ["path", "/Default Web Site"]);
if (scopeElementPos == -1)
{
   var scopeElement = authorizationRulesCollection.CreateNewElement("scope");
   scopeElement.Properties.Item("path").Value = "/Default Web Site";
   authorizationRulesCollection.AddElement(scopeElement);
}
else
{
   var scopeElement = authorizationRulesCollection.Item(scopeElementPos);
}

var scopeCollection = scopeElement.Collection;
var addElement = scopeCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "ContosoUser";
scopeCollection.AddElement(addElement);

adminManager.CommitChanges();

function FindElement(collection, elementTagName, valuesToMatch) {
   for (var i = 0; i < collection.Count; i++) {
      var element = collection.Item(i);
      if (element.Name == elementTagName) {
         var matches = true;
         for (var iVal = 0; iVal < valuesToMatch.length; iVal += 2) {
            var property = element.GetPropertyByName(valuesToMatch[iVal]);
            var value = property.Value;
            if (value != null) {
               value = value.toString();
            }
            if (value != valuesToMatch[iVal + 1]) {
               matches = false;
               break;
            }
         }
         if (matches) {
            return i;
         }
      }
   }
   return -1;
}

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT"
adminManager.SetMetadata "pathMapper", "AdministrationConfig"

Set authorizationSection = adminManager.GetAdminSection("system.webServer/management/authorization", "MACHINE/WEBROOT")
Set authorizationRulesCollection = authorizationSection.ChildElements.Item("authorizationRules").Collection

scopeElementPos = FindElement(authorizationRulesCollection, "scope", Array("path", "/Default Web Site"))
If scopeElementPos = -1 Then
   Set scopeElement = authorizationRulesCollection.CreateNewElement("scope")
   scopeElement.Properties.Item("path").Value = "/Default Web Site"
   authorizationRulesCollection.AddElement(scopeElement)
Else
   Set scopeElement = authorizationRulesCollection.Item(scopeElementPos)
End If

Set scopeCollection = scopeElement.Collection
Set addElement = scopeCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "ContosoUser"
scopeCollection.AddElement(addElement)

adminManager.CommitChanges()

Function FindElement(collection, elementTagName, valuesToMatch)
   For i = 0 To CInt(collection.Count) - 1
      Set element = collection.Item(i)
      If element.Name = elementTagName Then
         matches = True
         For iVal = 0 To UBound(valuesToMatch) Step 2
            Set property = element.GetPropertyByName(valuesToMatch(iVal))
            value = property.Value
            If Not IsNull(value) Then
               value = CStr(value)
            End If
            If Not value = CStr(valuesToMatch(iVal + 1)) Then
               matches = False
               Exit For
            End If
         Next
         If matches Then
            Exit For
         End If
      End If
   Next
   If matches Then
      FindElement = i
   Else
      FindElement = -1
   End If
End Function