After I wrote my post on How to block or unblock IP address in IIS programatically using .Net, I got few questions from users about having some difficulty on Windows 7. All the questions were related to the following line of code.
var ipSecuritySection = hostConfig.GetSection("system.webServer/security/ipSecurity", site);
GetSection method was either returning null object or throwing exception. This indicated that the specified section did not exist in IIS configuration on the machine. And there is a valid reason for it. On Windows 7, IPSecurity section is not enabled in IIS. First indication of this problem is that you will not see IP Address and Domain Restrictions icon in IIS feature view in IIS management console.
Goto Console Panel > Programs > Turn windows features on or off panel. Under IIS > World Wide Web Services > Security you will find IPSecurity section that is not checked. Check it and apply the change and then you should be all set.