Tuesday, September 1, 2009

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-->
<section name='MyConfigSection' type='System.Configuration.NameValueSectionHandler' />

<add key='MyKey' value='MyValue' />

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((

// Now, we can access keys in the config section

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

No comments: