.net – Unrecognized configuration section system.web/system.webServer

httphandleriis-7net

I am following the walkthrough for creating a synchronous http handler and choose the registration via integrated mode in IIS 7.5.

Using a web site project in Visual Studio 2010, for .NET 4.0, on IIS 7.5 the error message for the following part in web.config:

<configuration>
    <system.web>
        <compilation debug="false" targetFramework="4.0">
        </compilation>
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
            <handlers>
                <add verb="*" path="*.sample" name="Logger" type="Logger"/>
            </handlers>
        </system.webServer>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    </system.web>
</configuration>

is: Unrecognized configuration section system.web/system.webServer. It si an invalid child element. How should I fix it and why is it not recognized?

Best Answer

System.WebServer is a child node of Configuration and not System.Web. So, move the System.WebServer section outside of the System.Web section.