The <listenerAdapters> element specifies configuration settings for listener adapters for Internet Information Services (IIS) 7.0. Listener adapters are components that establish communication between non-HTTP protocol listener services and the Windows Process Activation Service (WAS). Changes to the <listenerAdapters> element take effect only when a listener adapter connects with WAS. In most cases, this connection requires that the server be restarted.
Notes:
- The World Wide Web Publishing Service (W3SVC) contains HTTP-specific functionality for IIS 7.0, so it does not use additional
<listenerAdapters> attributes.
- The FTP service, which does not require the WAS, does not have a
<listenerAdapters> entry.
| |
IIS 7.0 |
IIS 6.0 |
| Notes |
The <listenerAdapters> element is new in IIS 7.0. |
N/A |
The <listenerAdapters> element is included in the default installation of IIS 7.0.
There is no user interface for adding listener adapters for IIS 7.0. For examples of how to add listener adapters programmatically, see the Code Samples section of this document.
Attributes
None.
Child Elements
| Element |
Description |
add |
Optional element.
Specifies the configuration for a listener adapter. |
Configuration Sample
The following configuration sample adds a listener adapter for a Gopher protocol provider, and specifies both the name of the DLL and its initialization function.
<system.applicationHost>
<listenerAdapters>
<add name="gopher"
protocolManagerDll="%SystemRoot%\system32\inetsrv\gophersvc.dll"
protocolManagerDllInitFunction="GopherInit" />
</listenerAdapters>
</system.applicationHost>
The following code samples add a listener adapter for a Gopher protocol provider, and specify both the name of the DLL and its initialization function.
AppCmd.exe
appcmd.exe set config -section:system.applicationHost/listenerAdapters /+"[name='gopher',protocolManagerDll='%SystemRoot%\system32\inetsrv\gophersvc.dll',protocolManagerDllInitFunction='GopherInit']" /commit:apphost
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.GetApplicationHostConfiguration();
ConfigurationSection listenerAdaptersSection = config.GetSection("system.applicationHost/listenerAdapters");
ConfigurationElementCollection listenerAdaptersCollection = listenerAdaptersSection.GetCollection();
ConfigurationElement addElement = listenerAdaptersCollection.CreateElement("add");
addElement["name"] = @"gopher";
addElement["protocolManagerDll"] = @"%SystemRoot%\system32\inetsrv\gophersvc.dll";
addElement["protocolManagerDllInitFunction"] = @"GopherInit";
listenerAdaptersCollection.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.GetApplicationHostConfiguration
Dim listenerAdaptersSection As ConfigurationSection = config.GetSection("system.applicationHost/listenerAdapters")
Dim listenerAdaptersCollection As ConfigurationElementCollection = listenerAdaptersSection.GetCollection
Dim addElement As ConfigurationElement = listenerAdaptersCollection.CreateElement("add")
addElement("name") = "gopher"
addElement("protocolManagerDll") = "%SystemRoot%\system32\inetsrv\gophersvc.dll"
addElement("protocolManagerDllInitFunction") = "GopherInit"
listenerAdaptersCollection.Add(addElement)
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var listenerAdaptersSection = adminManager.GetAdminSection("system.applicationHost/listenerAdapters", "MACHINE/WEBROOT/APPHOST");
var listenerAdaptersCollection = listenerAdaptersSection.Collection;
var addElement = listenerAdaptersCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "gopher";
addElement.Properties.Item("protocolManagerDll").Value = "%SystemRoot%\\system32\\inetsrv\\gophersvc.dll";
addElement.Properties.Item("protocolManagerDllInitFunction").Value = "GopherInit";
listenerAdaptersCollection.AddElement(addElement);
adminManager.CommitChanges();
VBScript
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set listenerAdaptersSection = adminManager.GetAdminSection("system.applicationHost/listenerAdapters", "MACHINE/WEBROOT/APPHOST")
Set listenerAdaptersCollection = listenerAdaptersSection.Collection
Set addElement = listenerAdaptersCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "gopher"
addElement.Properties.Item("protocolManagerDll").Value = "%SystemRoot%\system32\inetsrv\gophersvc.dll"
addElement.Properties.Item("protocolManagerDllInitFunction").Value = "GopherInit"
listenerAdaptersCollection.AddElement(addElement)
adminManager.CommitChanges()