29

What does aspnet_regiis.exe do exactly other than updating the document mappings to correct aspnet_isapi.dll version, is updating the ASP.NET version from inetmgr same as running aspnet_regiis, I could not find any blog post or article describing the steps this particular batch command does. Please give any links you know of detailing the steps of aspnet_regiis.exe

Kiran Bheemarti
  • 1,439
  • 2
  • 12
  • 14

7 Answers7

19

My favorite feature of it, is the ability to encrypt settings in web.config something along the lines of:

aspnet_regiis -pe /myapprootvirtualdirector

and decrypt is -pd

encrypt only after deployment to the server - as encrypting on one machine won't be valid on the other unless you share machine keys.

Venkataraman R
  • 12,181
  • 2
  • 31
  • 58
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
16

From MSDN reference:

When multiple versions of the .NET Framework are executing side-by-side on a single computer, the ASP.NET ISAPI version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application. The ASP.NET IIS Registration Tool (Aspnet_regiis.exe) allows an administrator or installation program to easily update the script maps for an ASP.NET application to point to the ASP.NET ISAPI version that is associated with the tool. The tool can also be used to display the status of all installed versions of ASP. NET, register the ASP.NET version that is coupled with the tool, create client-script directories, and perform other configuration operations.

From Scott Forsyth's blog:

Starting in the first version of ASP.NET, Microsoft has provided a tool to control which version of the framework is registered in IIS. This tool, aspnet_regiis.exe, is quite flexible and with the right understanding of how IIS and ASP.NET work, can be used for most any situation.

Dhaust
  • 5,470
  • 9
  • 54
  • 80
tchrikch
  • 2,428
  • 1
  • 23
  • 43
  • 4
    **aspnet_regiis.exe** can also be quite useful for security... It can be used for things like encrypting global, machine level configuration files (machine / web.config & custom configuration files) – ganjeii Nov 20 '19 at 00:50
5

Please give any links you know of detailing the steps of aspnet_regiis.exe

aspnet_regiis.exe -h generates the following helpful information about how the utility works internally.

Microsoft (R) ASP.NET RegIIS version 4.0.30319.18408
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation.  All rights reserved.


                       -- ASP.NET REGISTRATION OPTIONS --


-i                  Install this version of ASP.NET and update IIS
                    configuration at the root level to use this version of
                    ASP.Net.



-ir                 Install this version of ASP.NET, register only. Do not
                    change any web applications to use this version.



-iru                Install this version of ASP.NET. If there are any existing
                    applications that uses ASP.NET, it will not change IIS
                    configuration to use this version.
S. Dixon
  • 842
  • 1
  • 12
  • 26
5

It reg isters ASPNET extensions with IIS.

ggonsalv
  • 1,264
  • 8
  • 18
5

It can also repair an install of aspnet.

Sometimes it just breaks and you need to run aspnet_regiis -i or -ir to fix it.

Joshua
  • 40,822
  • 8
  • 72
  • 132
3

I Faced an issue where localhost was not running(i.e. the website did not load).

I had installed IIS 10.0 express after I had installed Visual Studio along with .NET framework.

Due to this later installation of IIS , localhost did not load.

I ran aspnet_regiis -i under the path

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

This sucessfully solved the issue.

johnashu
  • 2,167
  • 4
  • 19
  • 44
3

It is useful to me to encrypt portions of my WebConfig file (In my case the connectionStrings).

Commands:

-- Go to regiss.exe directory
C:\Users\myuser>cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319

-- Execute the encryption
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -pef "connectionStrings" "C:\Users\MyPublishPath"

This will encrypt your conecctionStrings from this:

<connectionStrings>
  <add name="MyProjectDB" connectionString="Data Source=192.168.X.X;Initial Catalog=MyProjectDB;User ID=User;Password=Pass" providerName="SqlClient" />
</connectionStrings>

To this:

<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
  <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
  <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
  <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
    <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
      <KeyName>Rsa Key</KeyName>
    </KeyInfo>
    <CipherData>
      <CipherValue>ml2OVkgtMhrLcrTQfop5eR0D6eq6Q0a3qSOejeiMrB532H2LOHg8odKoDDTARbTrrZ1/x11Ur7GMHAYeemyBbXT5HCzbNGkMJfRBc=</CipherValue>
    </CipherData>
  </EncryptedKey>
</KeyInfo>
<CipherData>
  <CipherValue>H40nekXYEPWO+wbAh78FyzRM8s2t+UEo6h8NhN52BvbTqVOGlhS6+fBfbqdEvH5STExSeY2ftSUXEzNZ+PT6t2HgcpWk45FC3yw==</CipherValue>
</CipherData>

César León
  • 2,941
  • 1
  • 21
  • 18