i'm trying to encrypt my web.config.
aspnet_regiis keeps telling me: The configuration section 'applicationSettings' was not found.
I followed this site: Walkthrough: Creating and Exporting an RSA Key Container
My web.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="x" type="x" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="x.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<configProtectedData>
<providers>
<add name="MyProvider"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0. 0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL"
keyContainerName="MyKeys"
useMachineContainer="true" />
</providers>
</configProtectedData>
...
<applicationSettings>
<x.Properties.Settings>
<setting name="PollingInterval" serializeAs="String">
<value>10000</value>
</setting>
</x.Properties.Settings>
</applicationSettings>
</configuration>
I use the command: aspnet_regiis -pe "applicationSettings" -app "/MyApplication" -prov "MyProvider"
When I move the Section configProtectedData above the configSections it encrypts the applicationSettings, but removes the configSections-Section, anyway, IIS tells me configSections need to be the first element. I'm not sure what I'm doing wrong.
Is it a problem, that the applicationSettings is listed in the configSections?
Thank you for your help.
Ok, found the solution,
as stated in "configSections", "applicationSettings" is a SectionGroup, not a Section. aspnet_regiis can only encrypt Sections.
so I had to go one deeper: aspnet_regiis -pe "applicationSettings/x.Properties.Settings" -app "/MyApplication" -prov "MyProvider"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With