473,548 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CMAB in class library using machine.config

Hi,

I want to use the CMAB to retrieve configuration details for a class
library. More particular, I'm developping a Data Access Layer in class
libraries, with later on BL, allowing any application (as a Presentation
Layer) to access the business logic of the class library.
I'd like to store essential configuration details (connection strings,
environement settings) in the machine.config file, allowing the
DEV/TEST/PROD system only to differ in machine.config file.

When using the out of the box functionality, I get a FileNotFoundExc eption
thrown for ....\TestApplic ation.exe.confi g
when executing:
>>>> Hashtable configdata =new Hashtable();
configdata["ConnectionStri ng"]="Provider=MSDA ORA....";
ConfigurationMa nager.Write(con figdata);>>>>>


What does this indicate? Invalid/unsufficient configuration data

Any suggestions would be very appreciated, cause I don't seem to find the
cause. Looking into the code indicates that this file is tried to be read in
a ConfigSectionHa ndler:

_xmlAppConfigDo c.Load(
AppDomain.Curre ntDomain.SetupI nformation.Conf igurationFile );

But It's never indicated the file should exist. When I try to create the
file manually, it gets delete at program startup.

Kind regards,
Mattias

machine.confg excerpt:

....
<section name="applicati onConfiguration Management" type="..." />
<section name="TheRegist ry"
type="...Hashta bleSectionHandl er,...."/>
</configSections>
<!-- Configuration Management Application Block -->
<applicationCon figurationManag ement defaultSection= "TheRegistr y">
<configSectio n name="TheRegist ry">
<configProvid er assembly="..." type="....Regis tryStorage"
registryRoot="L ocalMachine" registrySubKey= "Software\MyCla ssLib"/>
</configSection>
</applicationConf igurationManage ment>
Jul 21 '05 #1
0 1342

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

Similar topics

10
3462
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get { return dbConnectionString;
1
1924
by: R. Raghuraman | last post by:
Hi, Q1: Do the section handlers in .NET work with CMAB? The CMAB seems to say so, but I am not sure. Q2: I am having trouble using CMAB with the standard section handler - I've been able to use CMAB with the HashtableSectionHandler. However, when I try to replace this with DictionarySectionHandler, I get a null reference exception: See...
3
2874
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem...
5
555
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when it is invoked by pressing "F5", or when the web.config file is modified. In all these cases the web.config file contains <identity...
10
1901
by: bradtm | last post by:
So I have this hierarchy: + Solution | |--- + Class Library Project | | | |--- LogError.vb | |--- + ASP .NET Web Application |
0
254
by: Mattias | last post by:
Hi, I want to use the CMAB to retrieve configuration details for a class library. More particular, I'm developping a Data Access Layer in class libraries, with later on BL, allowing any application (as a Presentation Layer) to access the business logic of the class library. I'd like to store essential configuration details (connection...
3
18522
by: Fernando Chilvarguer | last post by:
Hello! I created a Class Library project in VS2005. Then, using VS, I was able to add a connection string to the project settings, which automaticaly created an app.config file for me. If I try to access the configuration using System.Configuration.ConfigurationManager, I get a NullException. The code: string connectionString =
8
2420
by: Mihai Velicu | last post by:
Hi ! I created a class library and in it I have a class that call "ConfigurationManager" to find out what type of database I work and the connection string.When I call this class from a form, everithing is running well, no errors.When I call this class from a custom control I receive the message "Object reference not set to an instance of...
5
2848
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath) Dim section As New MembershipSection section = rootWebConfig1.GetSection("system.web/membership")
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7444
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7954
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.