简体   繁体   English

连接字符串加密

[英]connectionString encryption

I'm trying to encrypt the connection strings in my web.config.我正在尝试加密 web.config 中的连接字符串。 I'm following the instructions from Walkthrough: Creating and Exporting an RSA Key Container .我正在按照演练:创建和导出 RSA 密钥容器中的说明进行操作 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.我直接在“C:”根目录中创建了名为“MyApplication”的项目。

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?您是否将 MyApplication 文件夹添加为 IIS 中默认网站下的虚拟目录? 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.根据this MSDN post ,您可以使用-site来定义要定位的站点。 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.使用 –app 选项标识将为其加密 Web.config 文件的应用程序,使用 -site 选项标识应用程序所属的网站。 The Web site is identified using the site number from the Internet Information Services (IIS) metabase.该网站是使用 Internet 信息服务 (IIS) 元数据库中的站点编号标识的。 You can retrieve the site number from the INSTANCE_META_PATH server variable in the ServerVariables collection.您可以从 ServerVariables 集合中的 INSTANCE_META_PATH 服务器变量中检索站点编号。 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".例如,安装 IIS 时,会创建一个名为“默认网站”的网站作为站点 1。在该站点提供的页面中,INSTANCE_META_PATH 服务器变量返回“/LM/W3SVC/1”。 If you do not specify a -site option, site 1 is used.如果未指定 -site 选项,则使用站点 1。

/MyApplication is a virtual path and the message seems to indicate that path is not available ie there is no http://localhost/MyApplication . /MyApplication 是一个虚拟路径,该消息似乎表明该路径不可用,即没有http://localhost/MyApplication Did you forget to create virtual directory for your app in IIS?您是否忘记在 IIS 中为您的应用程序创建虚拟目录?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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