我有一个带有自定义配置部分的web应用程序.该部分包含我想加密的信息(我希望使用ASPNet_RegIIS而不是自己加密).
Web.Config:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="MyCustomSection"
type="MyNamespace.MyCustomSectionHandler, MyAssembly"/>
</configSections>
<configProtectedData>
<providers>
<clear />
<add name="DataProtectionConfigurationProvider"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL"
keyContainerName="MyKeyContainer"
useMachineContainer="true" />
</providers>
</configProtectedData>
<MyCustomSection>
<blah name="blah1">
<blahChild name="blah1Child1" />
</blah>
</MyCustomSection>
在try 加密之前,配置处理程序工作得很好.当我try 用以下方式对其进行加密时:
aspnet_regiis-pef"MyCustomSection"
我收到一个错误:
加密配置部分...一
我已在配置/未配置提供程序的情况下try .带/不带节组.事先/在没有启动网站的情况下.我已经try 将我的程序集暂时放在GAC中进行注册.我也try 了我的log4net部分,只是想try 一些不属于我的东西,但没有运气.我已以管理员身份运行命令提示符.有什么主意吗?或者ASPNet_RegIIS只是不能用于自定义部分吗?
查看MSDN之后的最后一次try 是将我的处理程序更改为从ConfigurationSection继承,而不是实现IConfigurationSectionHandler,因为它在2.0中在技术上已被弃用(希望它与aspnet_regiis版本有关).那里也不走运.
任何 idea 都让我知道.谢谢