Listener Adapters <listenerAdapters>
The <listenerAdapters>
element specifies configuration settings for listener adapters for Internet Information Services (IIS) 7. 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, so it does not use additional
<listenerAdapters>
attributes. - The FTP service, which does not require the WAS, does not have a<listenerAdapters>
entry.
Version | Notes |
---|---|
IIS 10.0 | The <listenerAdapters> element was not modified in IIS 10.0. |
IIS 8.5 | The <listenerAdapters> element was not modified in IIS 8.5. |
IIS 8.0 | The <listenerAdapters> element was not modified in IIS 8.0. |
IIS 7.5 | The <listenerAdapters> element was not modified in IIS 7.5. |
IIS 7.0 | The <listenerAdapters> element was introduced in IIS 7.0. |
IIS 6.0 | N/A |
The <listenerAdapters>
element is included in the default installation of IIS 7.
There is no user interface for adding listener adapters for IIS 7. For examples of how to add listener adapters programmatically, see the Code Samples section of this document.
None.
Element | Description |
---|---|
add |
Optional element. Specifies the configuration for a listener adapter. |
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 set config -section:system.applicationHost/listenerAdapters /+"[name='gopher',protocolManagerDll='%SystemRoot%\system32\inetsrv\gophersvc.dll',protocolManagerDllInitFunction='GopherInit']" /commit:apphost
Note
You must be sure to set the commit parameter to apphost
when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.
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();
}
}
}
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
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();
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()