Config file for assembly called by Commerce Server 2002 pipeline

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

I'm creating an assembly that has some configuration requirements (eg access
credentials to perform a service).

I guess my config settings would go in myapp.exe.config (windows app) or
web.config (asp.net app) like so...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="myAssemblySection"
type="System.Configuration.MyAssemblySectionHandler" />
</configSections>

<myAssemblySection name="myname" password="LJOIOIJSDLKJOIJOIUYRET" />

</configuration>

I suppose I should access this file like so
System.ConfigurationSettings.GetConfig(...)

My assembly is called by the following two routes:
1) Commerce Server pipeline (COM interop dll)
2) an ASP.Net app.

I have two requests:
1)Please confirm my assumptions above on configuring my assembly.
2) Will the Commerce Server pipeline route work? ie what config file will
it try to look in?


Thanks
Martin
 
Martin, your assumptions on configuring the assembly seem a bit wrong - read
the following articles for help with this:

http://msdn.microsoft.com/library/d...uide/html/cpconcreatingnewsectionhandlers.asp

http://msdn.microsoft.com/library/d...cpgrfaccessingaspnetconfigurationsettings.asp

http://msdn.microsoft.com/library/d...-us/cpgenref/html/gngrfappsettingselement.asp

To keep things simple at least to start with you might want to hold this
config info in appSettings then you don't have to create an
IConfigurationSectionHandler implementation in your class.

You're right about the file names for the configuration settings for windows
and asp.net apps.

For the commerce server pipeline component configuration settings, I'd try
putting them in the web.config file for the commerce server app that is
calling the pipeline and seeing if that works.
 
I thought have a separate section for my assembly's config provided better
scoping than putting it in appSettings, but I could do appSettings to start
with.

I hope some one from the Commerce Server group can answer the issue of
config file access from a pipeline component.

I'm on a tight timescale, and for now have hardcoded the config settings.

Thanks
Martin
 
You're right, it does provide better scoping to have a separate config
section for your assembly config, but putting it in appSettings certainly
reduces the amount of code you have to write in the first instance and as
you're on a tight timescale it seems like a good bet for now... :-)

Steve
 
Back
Top