vb.net – App.config连接字符串保护错误
发布时间:2020-12-17 00:03:31 所属栏目:大数据 来源:网络整理
导读:我遇到了以前的问题;找不到我如何解决它的参考. 这是问题所在.我们使用以下代码为客户端应用程序加密app.config中的连接字符串部分: config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) If config.ConnectionStrings.Sectio
我遇到了以前的问题;找不到我如何解决它的参考.
这是问题所在.我们使用以下代码为客户端应用程序加密app.config中的连接字符串部分: config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) If config.ConnectionStrings.SectionInformation.IsProtected = False Then config.ConnectionStrings.SectionInformation.ProtectSection(Nothing) ' We must save the changes to the configuration file.' config.Save(ConfigurationSaveMode.Modified,True) End If 问题是我们有一个营业员休假.旧的笔记本电脑将转到新的销售人员,并在新用户的登录下,当它试图这样做时,我们得到一个错误.错误是: Unhandled Exception: System.Configuration.ConfigurationErrorsException: An error occurred executing the configuration section handler for connectionStrings. ---> System.Configuration.ConfigurationErrorsException: Failed to encrypt the section 'connectionStrings' using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Object already exists. ---> System.Security.Cryptography.CryptographicException: Object already exists
我找到了一个更优雅的解决方案,在我对自己的原始回答中.我发现如果我刚刚以root用户身份登录,并且安装了应用程序并导致配置文件连接字符串被加密并在commadn提示符下转到.net framework目录并运行
aspnet_regiis -pa "NetFrameworkConfigurationKey" "{domain}{user}" 它授予其他用户访问RSA加密密钥容器的权限,然后它适用于其他用户. 我只是想在这里添加它,因为我认为我已经在我们的开发博客上发布了这个问题,但是在这里找到它,所以如果我需要再次查找它将会在这里.将在此主题中添加指向我们的开发博客点的链接. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |