MSDeploy连接字符串的自动加密,字典中找不到密钥

ced*_*lof 9 asp.net encryption web-config aspnet-regiis.exe msdeploy

由于使用标志支持Web Deploy 3.5连接字符串的自动加密:–EnableRule:EncryptWebConfig.但是,运行它时:

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='C:\[...]\MyApp.WebDeployPackage.zip' -dest:auto,includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\[...]\MyApp.SetParameters.xml" -EnableRule:EncryptWebConfig  -verbose
Run Code Online (Sandbox Code Playgroud)

我明白了:

Error Code: ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG
More Information: Failed to encrypt destination web.config: C:\[...]\Web.config.  
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG.
Error: The given key was not present in the dictionary.
Run Code Online (Sandbox Code Playgroud)

详细了解链接到过时的文档点,我似乎无法在网上找到任何信息.

我怀疑该工具在幕后使用aspnet_regiis,但我不确定.是的,我正在使用完全管理员权限运行上述内容.

Sta*_*ark 1

我遇到了同样的问题,但这不是由于嵌套web.config文件造成的。事实证明,由于某种原因,我的部署用户无法访问密钥容器(在 Web 部署服务错误日志中,抛出的异常是System.Configuration.ConfigurationErrorsException: The RSA key container could not be opened.)。

我最终使用了这个命令:aspnet_regiis -pa "NetFrameworkConfigurationKey" "<MYUSER>"提供<MYUSER>必要的访问权限。