由于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
我得到:
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.
Learn more-link指向过时的文档,我似乎无法在线找到任何信息。
我怀疑该工具在后台使用了aspnet_regiis,但我不确定。是的,我正在使用完整的管理员权限运行以上操作。
最佳答案
我有同样的问题,但这不是由于嵌套的web.config
文件。出于某种原因,我的部署用户无法访问 key 容器(在Web Deployment Service错误日志中,抛出的异常是System.Configuration.ConfigurationErrorsException: The RSA key container could not be opened.
)。
我最终使用了以下命令:aspnet_regiis -pa "NetFrameworkConfigurationKey" "<MYUSER>"
给予<MYUSER>
必要的访问权限。
关于asp.net - MSDeploy自动加密连接字符串,字典中找不到 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19636870/