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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment