Errors installing ASP.NET 4.0

Here is a little problem you might run into when trying to use aspnet_regiis.exe to register ASP.NET 4 on a site.

C:WindowsMicrosoft.NETFrameworkv4.0.30319>aspnet_regiis -i
Start installing ASP.NET (4.0.30319).
Finished installing ASP.NET (4.0.30319).
Setup has detected some errors during the operation. For details, please read the setup log file C:UsersjohnAppDataLocalTempASPNETSetup_00003.log


When you look into the mentioned log file and search for “fail” you find this:

2010-09-06 14:27:18 Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 800700b7: 'Cannot create a file when that file already exists. '

So what’s that all about?

Turns out it is actually down to the fact that aspnet_regiis.exe does not cope too well with the generally accepted environment variable that expands to the Windows directory. So when you look in your applicationHost.config file (in windowssystem32inetsrvconfig) you may find something like this:

             <add path="%windir%system32inetsrvasp.dll" allowed="true" groupId="ASP" description="Active Server Pages" />
             <add path="%windir%Microsoft.NETFramework64v2.0.50727aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
             <add path="%windir%Microsoft.NETFrameworkv2.0.50727aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" /> 
             <add path="%windir%Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
             <add path="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
             <add path="%windir%system32inetsrvwebdav.dll" allowed="true" groupId="WEBDAV" description="WebDAV" />

If you change the highlighted bits to the appropriate hard coded location (e.g. c:windows ) and try again you should find it works.



Comments (8)
  1. Karin says:

    This was great! Thanks a lot!

  2. Scott says:

    This is exactly what I needed.  Worked perfectly after following your steps.  Thanks a ton!!

  3. Jag Reehal says:

    Worked for me.

    Thank you very much.

  4. Patrick Koranda says:

    Thanks !!!!

  5. Sean says:

    Thanks very much for this, help me out.

  6. Bala says:

    This helped a lot. Thanks verymuch for the post

  7. I was able to resolve the issue on a windows2008r2 server by reinstalling .NET 4 using the following command line

    %windir%Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe -i

    You may need to change .NET version with the one you have on your machine, the version will be the v4.0 folder name under the

Comments are closed.

Skip to main content