Configuration API

G

Guest

Hello,
I was looking for specific feature in Configuration but I failed. What I
need, is to set up custom configuration loader - we do not use .NET
Configuration normally for server applications but trying to employ WCF we
need to register into ConfigurationManager (or WebConfigurationManager in
case of web applications) custom provider for sections required by WCF.
The first idea was to add registration of custom settings provider in
startup code. We can pull out the expected sections from our configuration
repository, so it would be transparent for WCF. However, it seems that
Configuration is not flexible enough (in .NET 2.0) as there is no method how
to override the default behavior of ConfigurationManager.AppSettings
property. Any idea?

This seems to be strange as I would expect this must be issue in many
applications, especially enterprise applications. Our scenario is that
logical application is spread into BizTalk, IIS and windows services. It runs
in clustered environment, so the configuration, to be managable, is in a
central place (shared folder available as clustered resource). Nobody wants
to distribute every setting change into every instance of every hosting
service.

Thanks a lot
eXavier
 
S

Steven Cheng[MSFT]

Hi eXavier,

As for the .NET Configuration API and Configuration Section behavior,
what's your expected behavior? So far the .NET 2.0 configuration model let
you define some custom configuration sections(with your customized section
structure and hierarchy) and access them in code. Here are some articles
mentioned this:

#Classes Used to Create Custom Section Handlers
http://msdn2.microsoft.com/en-us/library/ms228062.aspx

#How to: Create Custom Configuration Sections Using ConfigurationSection
http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx

#Declaring and Accessing Custom Configuration Sections
http://msdn2.microsoft.com/en-us/library/aa719887(vs.71).aspx

And as you've said, you can use ConfigurationManager or
WebConfigurationManager to open your running application's configuration
sections(both built-in ones or your custom ones) and read or update them.

In addition, as for the following things you mentioned:

============
as there is no method how to override the default behavior of
ConfigurationManager.AppSettings property.
================

what's the behavior you want to get by overrriding the AppSettings
property? Would you provide some further explanation so that I can do some
further research on this?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hello Steven,

I explain her the required functionality.

First, we use own internally developed Configuration Block (or API) that
uses different concept for locating configuration files. We don’t use .NET
Configuration. However the concept of sections and section providers is
similar in both APIs. The main difference in the approaches is that for
ConfigurationManager, an application is single executable while in our
approach, an application can consist of several physical processes
distributed to several physical machines or on the other hand, there could be
several applications hosted in single executable, like in BizTalk 2006 or
Composite Client applications. So we need to abstract from physical location
of single executable.

Now, we would like to employ WCF in our applications, but WCF internally
access application settings through ConfigurationManager, i.e. it reads
configuration from .exe.config of running process. WCF’s configuration
sections are quite rich and we don’t need to change their structure. What we
need, is to incorporate WCF’s configuration sections into our application’s
configuration repository to be manageable using application’s admin console.
(It’s possible to avoid loading WCF configuration from application
configuration file but then we would have to apply all settings manually,
which is not acceptable for us.)

Having these sections, we then need to instruct ConfigurationManager to use
the sections provided from our repository. The problem is, that
ConfigurationManager does not provide any adapter pattern to allow overriding
where the sections are loaded from.

Thanks for your feedback. Please let me know if I missed something or if you
had any idea for solution.

Sincerely
eXavier
 
S

Steven Cheng[MSFT]

Thanks for your reply eXavier,

Based on your further explanation, my current understanding is that you
want to let the .NET ConfigurationManager adopt some other customized
configuration source(such as from database or from web url ....) in
addition to the machine.config and app.config file, am I correct?

If this is the case, I'm afraid this is not supported so far as .net
framework runtime always think the system configuration(machine.config) and
application level configuration should be put in the fixed file with fixed
location(machine under framework folder and app.config in application root
folder). If you want to create a custom configuration editor, we may need
to create custom class that parse the XML document(config files).

Please feel free to let me know if there is anything I missed.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top