简体   繁体   中英

connectionString encryption

I'm trying to encrypt the connection strings in my web.config. I'm following the instructions from Walkthrough: Creating and Exporting an RSA Key Container . However, when I get to the part with the command:

aspnet_regiis -pe "connectionStrings" -app "/MyApplication" -prov "MyProvider"

it keeps complaining:

"The configuration for the virtual path '/MyApplication' and site 'Default Web Site' cannot be opened

Failed to map the path '/myapplication'
Failed!

I'm fairly sure I've followed the instructions correctly. I created the project named 'MyApplication' directly in the 'C:' root.

Any ideas? Perhaps I should be following a different set of instructions?

Thanks for your answers. Turned out I needed to run the command prompt as "Administrator"

Did you add the MyApplication folder as a virtual directory in IIS under the default web site? That seems to be what it's looking for, not a folder path...

According to this MSDN post , you can use -site to define the site to target. An excerpt from that site:

Use the –app option to identify the application for which the Web.config file will be encrypted and the -site option to identify which Web site the application is a part of. The Web site is identified using the site number from the Internet Information Services (IIS) metabase. You can retrieve the site number from the INSTANCE_META_PATH server variable in the ServerVariables collection. For example, when IIS is installed, a Web site named "Default Web Site" is created as site 1. In pages served from that site, the INSTANCE_META_PATH server variable returns "/LM/W3SVC/1". If you do not specify a -site option, site 1 is used.

/MyApplication is a virtual path and the message seems to indicate that path is not available ie there is no http://localhost/MyApplication . Did you forget to create virtual directory for your app in IIS?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM