Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use aspnet_regiis encrypt web.config in windows 7/2008 environment

I used aspnet_regiis successfully encrypted web.config file which running on windows 2003 server. However it doesn't work in IIS 7 on Windows 7/2008 server.

When I try to run the followng command in 64bit Windows 2008 server, it always shows the aspnet_regiis options help. The same thing is in windows 7 OS.

C:\Windows\Microsoft.Net\Framework64\v2.0.50727\aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4

If I open Visual Studio 2008 command in windows 7 and run the following command, I got those. I use the site Id from iis manager.

aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4 Failed to resolve the site ID for '4' Failed!

like image 609
travelman Avatar asked Apr 27 '11 19:04

travelman


People also ask

How to encrypt Section of Web Config?

Encrypting a Web Configuration Section To encrypt configuration file contents, use the Aspnet_regiis.exe tool with the –pe option and the name of the configuration element to be encrypted. Use the –app option to identify the application for which the Web.

How to encrypt and decrypt Web Config file?

In order to encrypt the ConnectionString section in the Web. Config file, we will need to use the aspnet_regiis.exe tool. Action – It notifies the action to be performed. In order to perform Encryption, the parameter value is -pef.


1 Answers

Have you tried running a command window "As Administrator"? This just caught me out for a moment too but running as admin fixed it.

like image 69
Troy Hunt Avatar answered Sep 18 '22 13:09

Troy Hunt