473,383 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Configuration Management Application Block woes

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)
Nov 15 '05 #1
1 4844
I just struggled with this today. I have an example identical to yours
that works. When I compare my App.config to your config I see a
difference in one line and I think it is your problem.

<section name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationMan agement.ConfigurationManagerSectionHandler,Microso ft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=nul l" />

Notice that the "type=" element in yours doesn't refer to anything
having to do with the Microsoft.ApplicationBlock for Configuration.
See if that helps.

Paul V. Sullivan
On 25 Nov 2003 09:54:43 -0800, gi**************@cob.osu.edu (Jason)
wrote:
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.ConfigurationManageme nt.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=nu ll"/>

<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.Configurati onManagement,

Version=1.0.0.0,Culture=neutral,PublicKeyToken=nu ll"

type="Microsoft.ApplicationBlocks.ConfigurationMa nagement.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",tb l);

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!


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Serge Calderara | last post by:
Dear all, I am building an application whcihc requires different set of parametes in order to work and get configured correctly. Those configuration parameters can be global to all modules of...
6
by: Serge calderara | last post by:
Dear all, Does any one have a ready class that is able to access a configuration file and make different type of querry, read, write operation? Why re invanting the real if something already...
1
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
0
by: Nick Carter | last post by:
Microsoft's Configuration Management Application Block (CMAB) allows me to specify which Configuration Storage Provider (CSP) to use in the application's config file. I am writing a .NET library...
0
by: msnew.microsoft.com | last post by:
I am working on a dotnet application and I wanted to make sure that if I used the Configuration Management Application Block the application would work on any windows OS as long as it had .net...
0
by: Tom | last post by:
Does anyone know if you can use the Configuration Management Application Block (CMAB) for app.config files? Or do those particular .config files need to be XML and in a specific format? Going to...
1
by: Jorge Besada | last post by:
I am planning on using the Configuration Management Application Block. The Block reads the app.config file the first time it is used. What if I want to add a new section/configSection and have the...
1
by: Lau | last post by:
Is it possible to use the Configuration Management Application Block in a Smart Device application? I’m using Visual Studio .Net v. 7.1 and C#. -- --------------------
7
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.