B
Basem
I have found people with similar errors using the
ConfigurationManagement application block, but those solutions don't
seem to do anything...basically, just trying to read in a
configuration xml file using this application block, and getting the
same error over and over no matter what.
Here is my setup:
app.config file:
----------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManagerSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
<section
name="OtherConfigFile"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.XmlHashtableSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"
/>
</configSections>
<applicationConfigurationManagement defaultSection="OtherConfigFile"<configSection name="OtherConfigFile">
<configProvider assembly="Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileStorage"
refreshOnChange="true"
encrypted="false"
path="C:\Config\otherConfigFile.xml"/> <!-- Please correct
the path if the sample is not being run from VS.NET -->
</configSection>
</applicationConfigurationManagement>
</configuration>
Below is the Sample file I took from Microsfot and placed at
C:\Config\
otherConfigFile.xml:
--------------------
<configuration>
- <OtherConfigFile>
- <CustomConfigurationData
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Color>Burnt Orange</Color>
<SomeText>FROM THE CONFIG FILE, not encrypted</SomeText>
<Size>3245</Size>
</CustomConfigurationData>
</OtherConfigFile>
</configuration>
In my main code, I just do the following line of code to initialize:
ConfigurationManager.Initialize();
I continuously get the following error:
{"Object reference not set to an instance of an object." }
I have actually stepped through the ConfigurationManagement code, and
it just doesn't seem to execute the following line of code properly,
always returning a null object:
(From ConfigurationManagerSectionHandler --> Instance)
_singletonSelf = (ConfigurationManagementSettings)ConfigurationSettings.GetConfig(
"applicationConfigurationManagement" );
I would really appreciate any insight into getting this situation to
work...basically, I'd like to use this applicationblock for loading
config data to and from xml files...
Thanks
ConfigurationManagement application block, but those solutions don't
seem to do anything...basically, just trying to read in a
configuration xml file using this application block, and getting the
same error over and over no matter what.
Here is my setup:
app.config file:
----------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManagerSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
<section
name="OtherConfigFile"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.XmlHashtableSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"
/>
</configSections>
<applicationConfigurationManagement defaultSection="OtherConfigFile"<configSection name="OtherConfigFile">
<configProvider assembly="Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileStorage"
refreshOnChange="true"
encrypted="false"
path="C:\Config\otherConfigFile.xml"/> <!-- Please correct
the path if the sample is not being run from VS.NET -->
</configSection>
</applicationConfigurationManagement>
</configuration>
Below is the Sample file I took from Microsfot and placed at
C:\Config\
otherConfigFile.xml:
--------------------
<configuration>
- <OtherConfigFile>
- <CustomConfigurationData
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Color>Burnt Orange</Color>
<SomeText>FROM THE CONFIG FILE, not encrypted</SomeText>
<Size>3245</Size>
</CustomConfigurationData>
</OtherConfigFile>
</configuration>
In my main code, I just do the following line of code to initialize:
ConfigurationManager.Initialize();
I continuously get the following error:
{"Object reference not set to an instance of an object." }
I have actually stepped through the ConfigurationManagement code, and
it just doesn't seem to execute the following line of code properly,
always returning a null object:
(From ConfigurationManagerSectionHandler --> Instance)
_singletonSelf = (ConfigurationManagementSettings)ConfigurationSettings.GetConfig(
"applicationConfigurationManagement" );
I would really appreciate any insight into getting this situation to
work...basically, I'd like to use this applicationblock for loading
config data to and from xml files...
Thanks