本文介绍了加密web.config失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道ppl已经问过有关加密web.config的问题。

I know that ppl have already asked questions regarding encrypting web.config.

我还试图加密我的测试配置文件,但我收到了这个错误。

im also trying to encrypt my test config file, but im getting this error.

aspnet_regiis -pef connectionStrings C:\encryptedWeb.config
加密配置部分...
物理路径'C的配置: \EncryptedWeb.config'无法打开。
失败!

aspnet_regiis -pef "connectionStrings" "C:\encryptedWeb.config"Encrypting configuration section...The configuration for physical path 'C:\EncryptedWeb.config' cannot be opened.Failed!

我只想知道,失败的原因可能是什么。

I just want to know, what could be reasons that it failed.

我得到了答案,这是问题web.config的readonly属性。
删除了只读元素后,它像一种魅力。

I got the answer, it was the readonly property of the web.config which was the problem.After I removed the readonly It worked like a charm.

推荐答案

对于命令 aspnet_regiis -pef,路径配置文件的路径是物理路径(不是虚拟路径),也是web.config所在的目录/文件夹的路径。因此,如果您的web.config路径位于 D:\MyConfiguration\web,则不应在路径中包含文件名,例如

for the command "aspnet_regiis -pef" the path of configuration file is the physical path (Not virtual) and also it is the path of directory/folder where web.config resides. So one should not include the name of file in path e.g.

。配置,然后在加密/解密时将按以下方式使用它:

if your web.config path is at D:\MyConfiguration\web.config then while encrypting/decrypting you will use it as follow:

加密:

aspnet_regiis -pef [sectionName] D:\MyConfiguration

解密:

aspnet_regiis -pdf [sectionName] D:\MyConfiguration

这篇关于加密web.config失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 09:06