【发布时间】:2010-10-21 18:25:49
【问题描述】:
我加密了我的 web.config 的 AppSettings 部分,在我的机器上对其进行了测试并且它工作,但是当我上传到在线使用它时它给了我一个错误:
配置错误描述:一个 处理过程中发生错误 所需的配置文件 服务这个请求。请查阅 下面的具体错误详细信息和 修改你的配置文件 适当的。
解析器错误消息:未能 使用提供者解密 '数据保护配置提供者'。 来自提供商的错误消息:密钥 在指定状态下使用无效。 (HRESULT 异常:0x8009000B)
Line 24: <appSettings configProtectionProvider="DataProtectionConfigurationProvider">
Line 25: <EncryptedData>
我使用以下子加密:
Private Sub ProtectSection(ByVal sectionName As String, ByVal provider As String)
Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)
Dim section As ConfigurationSection = config.GetSection(sectionName)
If section IsNot Nothing AndAlso Not section.SectionInformation.IsProtected Then
section.SectionInformation.ProtectSection(provider)
config.Save()
End If
End Sub
【问题讨论】:
标签: asp.net vb.net encryption web-config