Cannot use aspnet_regiis to encrypt web.config in a Windows 7/2008 environment

I used aspnet_regiis to successfully encrypt the web.config file, which works on a Windows 2003 server. However, it does not work on IIS 7 on a Windows 7/2008 server.

When I try to run the followng command on a 64-bit Windows 2008 server, it always displays the aspnet_regiis settings help. The same thing happens in Windows 7.

C: \ Windows \ Microsoft.Net \ Framework64 \ v2.0.50727 \ aspnet_regiis -pe "appSettings" -app "/ ConnectionTest" -site 4

If I open a Visual Studio 2008 command in Windows 7 and run the following command, I got it. I am using the site id from iis manager.

aspnet_regiis -pe "appSettings" -app "/ ConnectionTest" -site 4 Failed to resolve site ID for "4" Error!

+6
source share
2 answers

Have you tried to run the "As Administrator" command window? It just delayed me for a moment, but it works as an administrator fixed it.

+14
source

I got this error even after running the command line as an administrator. But I noticed that the virtual directory in my case had several words separated by a dot. Like "Web.Api.XYZApi".

I changed the name of the virtual directory to "XYZApi" (without dots) and tried to encrypt, and it worked. But I'm still not sure why this should be a problem.

0
source

Source: https://habr.com/ru/post/886824/


All Articles