I am trying to re-install ASP.NET on IIS7 running in Win7/64, which magically stopped working all of as sudden.

When I run aspnet_regiis -i, I get an error message that says

Finished installing ASP.NET (4.0.30319). Setup has detected some errors during the operation. For details, please read the setup log file C:\Users\username\AppData\Local\Temp\ASPNETSetup_00031.log

Looking at the log, it reports

Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 800700b7: 'Cannot create a file when that file already exists. '

The real problem surfaces when trying to access an ASP.NET web page from that server:

HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list


Most likely causes: Managed handler is used; however, ASP.NET is not installed or is not installed completely. There is a typographical error in the configuration for the handler module list.

So it seems ASP.NET has NOT been properly re-installed. Now, I am aware of the alleged one-and-only remedy for this, repeated all over the Web, and referenced for example here:


Except that the proposed solution does not work for me. I have expanded the %windir% macros within isapiCgiRestriction section for .NET 4.0 - and aspnet_regiis still fails for me.

Any other ideas?

  • I am having exactly the same problem. The cause in my case is that I installed visual studio 11 preview, then uninstalled it. This seems to have left IIS with an invalid installation of .net 4. I have had to reinstall visual studio and go through the various installs that were made as part of the preview and uninstall them. Then I removed and re-added IIS. I still get this error. I also tried the fix linked to, but it has no effect. It seems that aspnet_regiis just won't install.
    – user110684
    Feb 14, 2012 at 22:25
  • @Lamaan Did you manage to fix this? I'm trying to run an app build in VS2010 through IIS and can't seem to get the virtual directory to create properly. I tried aspnet_regiis and have the same problems as you.
    – Matt
    Mar 14, 2012 at 9:59

5 Answers 5


I should mention that the problem went away as soon as I installed the RTM version of Visual Studio 2012. Like user110684, I did initially install the preview of what was then called VS11 and that may have been what did us both in. At any rate, after installing the final release of VS2012, along with .NET 4.5 that comes with it, I no longer see the problem.


We recently ran into the same logged error, 'Cannot create a file when that file already exists.', on Windows 7 while trying use "Turn Windows features on or off" to add features to IIS. The solution was:

  1. Stop IIS.
  2. Use "Turn Windows features on or off" to completely remove Internet Information Services.
  3. Reboot.
  4. Stop IIS.
  5. Use "Turn Windows features on or off" to add all desired Internet Information Services features. (An error message may be displayed. Ignore it.)
  6. Reboot.
  7. If necessary, run aspnet_regiis -i.

Try this, in prioritized order:

  1. Make sure you run aspnet_regiis -i from an elevated command prompt.
  2. Try the 64-bit version of the tool (located in %windir%\Microsoft.NET\Framework64\ )
  3. Re-install the .Net 4.0 Framework - the installer should perform the registrations automatically, no need to run aspnet_regiis manually

I don't think this error means what it says, i encountered the same error in VB6 when doing HTTP calls, the root issue for me was I was setting a header twice (odd). Maybe this is helpful to someone.


Please set your application from integrated to classic. Please let me know how it works. Good luck

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .