Last post Dec 06, 2010 03:09 PM by dsprado
Dec 03, 2010 04:29 PM|dsprado|LINK
I am trying to encrypt a section of a web.config file in the root of a virtual server. The server is not the 'default server' in IIS, so aspnet_regiis -pe "appSettings" -app "/" doesn't work as it defaults to the default web site. Also, the source code is access
through a UNC path and is load balanced across multiple servers (web farm environment). aspnet_regiis -pef "appSettings" "\\UNC\path" fails, stating "The configuration for physical path '\\UNC\path' cannot be opened. The user
account that I'm running the utility as, has rights to the path.
I found one post (from very early .NET 2.0 days) that indicated that you could use
aspnet_regiis -pe "connectionStrings" -app "w3svc/72/root/" -prov "CustomProvider". But this syntax returns an error stating that "The value used in the -app parameter must begin with a forward slash."
Can anyone tell me what the correct syntax would be in a case like this?
Dec 04, 2010 01:19 AM|chravikishore|LINK
Look at this
link. i think this will help you.
Try the follwoing
aspnet_regiis -pe "connectionStrings" -app "/w3svc/72/root/" -prov "CustomProvider"
Dec 06, 2010 03:09 PM|dsprado|LINK
The syntax that you provided still didn't quite work, but the link did point me to the solution. The following command did encrypt the file:
aspnet_regiis -pe "appSettings" -app "/" -site "sitename" -prov "CustomProvider"
I had to try multiple variations before I found that the -site flag would allow you to provide the 'friendly' site name, ie the name that shows up in the IIS management console. Unfortunately, once the web.config file was encrypted and the app pool was restarted
on both servers, I got a stack trace error. It appears that the server isn't able to decrypt the file during initialization. I'll start searching the forums for an answer to this problem next.
Thanks for the help.