Archive

Posts Tagged ‘IIS 7’

Could not find how to configure httpModules using appcmd.exe

June 22nd, 2010 No comments

So I found the way to set the appSettings and connectionString in my web.config using appcmd.exe, but I tried every think I could to add an http Module to the <httpModules> section of the <system.web> with no success.

As it turns out in IIS 7 both <httpModules> and <httpHandlers> in <system.web> have been moved to <Modules> and <Handlers> in <system.webServer>. If you are using both the old location and the new location you will need to add the following item in the <system.webServer> section of the web.config file.

<system.webServer>
<validation validateIntegratedModeConfiguration=”false” />
</system.webServer>

You can now use the following appcmd.exe commands:

Add Module (httpModule)

Set appcmd =C:\Windows\System32\inetsrv\appcmd.exe
Set SiteName=”Default Web Site”
%appcmd% set config %SiteName% /section:system.webServer\Modules /+”[name='<http Module Name>',type='<Module class and assembly information>']“

Remove Module (httpModule)

Set appcmd =C:\Windows\System32\inetsrv\appcmd.exe
Set SiteName=”Default Web Site”
%appcmd% set config %SiteName% /section:system.webServer\Modules /-”[name='<http Module Name>']“

Reference:

ASP.NET 2.0 Breaking Changes on IIS 7.0 at http://learn.iis.net/page.aspx/381/aspnet-20-breaking-changes-on-iis-70/