LCJ*_*LCJ 5 c# asp.net iis iis-7 windows-server-2008
应用加密时,我们收到以下错误(在asp.net网站上).
分析器错误消息:无法使用提供程序"RsaProtectedConfigurationProvider"进行解密.来自提供程序的错误消息:无法打开RSA密钥容器.
注意:请参阅我们遵循的下列步骤.(我们已经在NetFrameworkConfigurationKey上授予NT Authority\Network Service的ACL权限)
注意:我们在IIS7中使用启用Windows身份验证和启用ASP.NET模拟.它在Windows Server 2008中运行.根据用户是否属于允许的AD组(将在配置文件中列出)来控制访问.
有趣的是,当group1的用户(来自location1)访问它时会发生此错误.当group2的用户(来自locatiob2)尝试访问它时,错误不会发生.
有关如何纠正它的任何想法?
我们已从部署文档中按照下面列出的步骤进行操作.
•验证defaultProvider ="RsaProtectedConfigurationProvider"
•验证keyContainerName ="NetFrameworkConfigurationKey"
注意:machine.config的默认位置是C:\ WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config
LCJ*_*LCJ 12
以下是我尝试过的一种不涉及机器配置的方法.
注意:如果目标位于Windows Sever 2008中,则需要在Windows Server 2008本身中执行加密步骤.
在服务器A中执行以下代码
注意: - 注册密钥
cd C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -pc "MyProjectKeys" -exp
Run Code Online (Sandbox Code Playgroud)
注意: - 仅在服务器A上授予访问权限
aspnet_regiis.exe -pa "MyProjectKeys" "IIS APPPOOL\testpsreloservices"
aspnet_regiis.exe -pa "MyProjectKeys" "NT AUTHORITY\NETWORK"
Run Code Online (Sandbox Code Playgroud)
导出的包含RSA密钥的XML文件
aspnet_regiis.exe -px "MyProjectKeys" E:\wmapps\webroot\myservice\MyProjectKey.xml –pri
Run Code Online (Sandbox Code Playgroud)
在web.config中添加了以下内容
<configProtectedData>
<providers>
<clear/>
<remove name="RSAProtectedConfigurationProvider" />
<add name="RSAProtectedConfigurationProvider" keyContainerName="MyProjectKeys"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,

Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
 processorArchitecture=MSIL"
useMachineContainer="true" />
</providers>
</configProtectedData>
Run Code Online (Sandbox Code Playgroud)
加密
aspnet_regiis -pef "connectionStrings" "E:\wmapps\webroot\myservice" -prov "RsaProtectedConfigurationProvider"
Run Code Online (Sandbox Code Playgroud)
在B服务器中复制加密文件.将密钥xml文件复制到B服务器.
使用以下命令创建批处理文件并执行(用于密钥注册和授予访问权限)
c:
cd C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -pi "MyProjectKeys" E:\wmapps\webroot\myservice\MyProjectKey.xml
aspnet_regiis.exe -pa "MyProjectKeys" "IIS APPPOOL\testpsreloservices"
aspnet_regiis.exe -pa "MyProjectKeys" "NT AUTHORITY\NETWORK"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
33077 次 |
最近记录: |