Can't find httpModules and httpHandlers inside

2019-08-12 08:20发布

问题:

I've read a post about httpHandlers and httpModules in ASP.NET and it said that there are such nodes (<httpModules> and <httpHandlers>) defined by default inside machine.config but when I looked they are not there. I've searched the machine.config at path "$WINDOWS$\Microsoft.NET\Framework\$VERSION$\CONFIG".

The only references are these 2 lines:

<section name="httpHandlers" type="System.Web.Configuration.HttpHandlersSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="httpModules" type="System.Web.Configuration.HttpModulesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

I am using Win7, IIS7 and .NET version 4.5

回答1:

The machine configuration file, Machine.config, contains settings that apply to an entire computer. It defines such common configSections as <httpModules> and <httpHandlers> for custom modules and custom handlers so that you do not need to declare them on each website on your machine separately but directly use as

<httpModules>
   <add name="..." type="..." /> 
</httpModules>

There are no custom modules/handlers defined for an entire machine configuration and by default, the machine.config file has no <httpModules> and <httpHandlers>



回答2:

You can get a list of modules using appcmd if that's all you're trying to do. appcmd list config site/vdir -section:"system.web/httpModules"