Using App.Config Settings in BizTalk 2004

This is an example of how to use app.config settings in a BizTalk 2004 Orchestration.
First, you must setup the configuration section that you want to use. This is an example of what this looks like:

<!–This is an example of setting up your configuration section–>
<configuation>
<configSections>
<section name=’MyConfigSection’ type=’System.Configuration.NameValueSectionHandler’ />
</configSections>

<MyConfigSection>
<add key=’MyKey’ value=’MyValue’ />
</MyConfigSection>
</configuration>

Then, create an orchestration variable of type System.Collections.Specialized.NameValueCollection (I’ll call it varConfigHandler)

This is an example of using the varConfigHandler in an expression shape:

// varConfigHandler has to be instantiated and bound to the config section we are interested in
// Notice that the result of the GetConfig function call is being cast into a NameValueCollection
varConfigHandler = new System.Collections.Specialized.NameValueCollection((
System.Collections.Specialized.NameValueCollection)
System.Configuration.ConfigurationSettings.GetConfig(“MyConfigSection”));

// Now, we can access keys in the config section
varConfigHandler.Get(“MyKey”);

For deployment, copy the configSections/section and MyConfigSection into the config file for the BizTalk Service which is located at:

C:\Program Files\Microsoft BizTalk Server 2004\BTSNTSvc.exe.config

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s