加密C#web配置失败 [英] Encryption C# web config fails
问题描述
我尝试使用命令加密web.config
  cd C:\ Windows \ Microsoft.NET.NET \ Framework64 \v4.0.30319
  aspnet_regiis.exe -pc" CustomKeys16" -exp $
  aspnet_regiis.exe -pa" CustomKeys16" "NT AUTHORITY\NETWORK SERVICE""
  aspnet_regiis -pef" connectionStrings" " C:\Users\cnandy\Desktop\Test\Websites\AccountDeduplicationWeb" -prov" CustomProvider"
  aspnet_regiis -px" CustomKeys16" "C:\ Users \cnandy \Desktop \New folder \ encrypt.xml"" -pri
他们第一次工作正常。
现在解密并更改web配置连接字符串中的内容如果我再次尝试使用命令加密显示错误。
C:\ Windows \ system32> cd C:\ Windows \ Microsoft \ \\ v4.0.30319
C:\ Windows \ Microsrosoft.NET \ Framework64 \v4.0.30319> aspnet_regiis.exe -pc" CustomKey
s16" -exp
创建RSA密钥容器...
RSA密钥容器已存在。
失败!
C:\ Windows \ MyMicrosoft.NET \ Framework64 \v4.0.30319> aspnet_regiis.exe -pa" CustomKey
s16" "NT AUTHORITY\NETWORK SERVICE"
$
添加ACL以访问RSA密钥容器...
成功!
C:\ Windows \ microsoft.NET \ Framework64 \v4.0.30319> aspnet_regiis -pef" connectionSt
rings" " C:\Users\cnandy\Desktop\Test\Websites\AccountDeduplicationWeb" -prov"Cu
stomProvider"
加密配置部分...
$
成功!
C:\ Windows \ Macrooft.NET \ Framework64 \v4.0.30319> aspnet_regiis -px" CustomKeys16"
" C:\ Users \\ \\ cnandy \Desktop \New folder\encrypt.xml" -pri
将RSA密钥导出到文件...
密钥无法在指定状态下使用。
失败!
$
C:\ Windows \ MicroStoswork.NET \ Framework64 \v4.0.30319>暂停
按任意关键是继续。 。 。$
修改网络配置一次后,是否无法重新运行加密并成功导出密钥?
I tried to encrypt web.config using the commands
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis.exe -pc "CustomKeys16" -exp
aspnet_regiis.exe -pa "CustomKeys16" "NT AUTHORITY\NETWORK SERVICE"
aspnet_regiis -pef "connectionStrings" "C:\Users\cnandy\Desktop\Test\Websites\AccountDeduplicationWeb" -prov "CustomProvider"
aspnet_regiis -px "CustomKeys16" "C:\Users\cnandy\Desktop\New folder\encrypt.xml" -pri
they work fine first time.
Now after decryption and changing something in the web config connection string if I again try to encrypt using the commands it shows the errors.
C:\Windows\system32>cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -pc "CustomKey
s16" -exp
Creating RSA Key container...
The RSA key container already exists.
Failed!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -pa "CustomKey
s16" "NT AUTHORITY\NETWORK SERVICE"
Adding ACL for access to the RSA Key container...
Succeeded!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pef "connectionSt
rings" "C:\Users\cnandy\Desktop\Test\Websites\AccountDeduplicationWeb" -prov "Cu
stomProvider"
Encrypting configuration section...
Succeeded!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -px "CustomKeys16"
"C:\Users\cnandy\Desktop\New folder\encrypt.xml" -pri
Exporting RSA Keys to file...
Key not valid for use in specified state.
Failed!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>pause
Press any key to continue . . .
Can't it be possible to re-run encryption and export successfully the key after modifying the web config once ?
推荐答案
请帮忙。
这篇关于加密C#web配置失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!