Hi,
I'm trying to integrate Microsoft's Configuration Management
Application Block (CMAB), and have run into a bit of trouble. Would
appreciate any input anybody could provide at this point. I simply
keep running into exceptions when trying to integrate the block into
my app. Here's what I've done thus far:
1. Installed the CMAB
2. Started a new C# project.
3. Set a reference to the
Microsoft.ApplicationBlocks.ConfigurationManagemen t.dll assembly.
All clear so far. Here's where matters have gotten nasty. I simply
want to use the XML File Storage Provider, for the moment, no
encryption, nor signing. I just want to see things working. So here's
what I did next:
4. Created an XML configuration file called ConfigTest.xml:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<TestConfigSection>
</TestConfigSection>
</configuration>
5. Added an app.config file called gilmore.exe.config file, saving it
to C:\. Within this file I placed the following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="applicationConfigurationManagement"
type="System.Configuration.NameValueSectionHandler ,System.Configuration,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=nul l"/>
<section name="TestConfigSection"
type="Microsoft.ApplicationBlocks.ConfigurationMan agement.XmlHashtableSectionHandler,
Microsoft.ApplicationBlocks.ConfigurationManagemen t,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=nul l" />
</configSections>
<applicationConfigurationManagement
defaultSection="TestConfigSection">
<configSection name="TestConfigSection">
<configProvider
assembly="Microsoft.ApplicationBlocks.Configuratio nManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=nul l"
type="Microsoft.ApplicationBlocks.ConfigurationMan agement.Storage.XmlFileStorage"
path="C:\ConfigTest.xml"
refreshOnChange="true"
signed="false"
encrypted="false" />
</configSection>
</applicationConfigurationManagement>
</configuration>
The application built just fine, no errors at all. I created a very
simple form consisting of just a button. I then created an onClick
event for that button, and within the handler code I placed the
following:
ConfigurationManager.Initialize();
Hashtable tbl = new Hashtable();
tbl.Add("testkey", "testvalue");
ConfigurationManager.Write("TestConfigSection",tbl );
However, I keep getting the exception:
====
An unhandled exception of type 'System.NullReferenceException'
occurred in microsoft.applicationblocks.configurationmanagemen t.dll
Additional information: Object reference not set to an instance of an
object.
=====
Any ideas here??? I'm desperate!
Thanks so much,
Jason
gi**************@cob.osu.edu (remove 'hatesspam' to send me an email)