Using Configuration in BizTalk Map

Sorry for delay guys, I am coming with remaining pipeline articles very soon. Meanwhile, here is an interesting and useful thing to share.

During BizTalk map definition, sometime you might require to read some configuration value. For example, during use of database related functoids, you have to make connection string configurable. You can use BizTalk config file and scripting functoid to handle such scenario.

 Here is what you need to do -

1. Open "BTSNTSvc.exe.config" file from "drive:\Program Files\Microsoft BizTalk Server 2006 ".

2. Add configuration setting there such as -


     <add key="CONNSTR" value="Data Source=SQL-SERVER;Initial Catalog=SAMPLE_DB;Integrated Security=SSPI"/>


3. In map file, drag and drop script functoid and write following inline c# script.

   public string GetConnectionString()
               string connString=System.Configuration.ConfigurationSettings.AppSettings.Get("CONNSTR").ToString();
               return connString;

4. While using any database related functoid, drag output of script functoid as input in database functoid. And do not forget to put it in correct parameter sequence.

That’s it.

One more last thing, you cannot test config value in map at design time because configuration values are read BTS host at runtime.



Comments (4)

  1. Sanket B says:

    To test the config value in map at the design time, you will need to add the same configuration string to the visual studio config.

    Definitely not a very impressive thing to do. But can help a lot when debugging complex maps.


  2. During BizTalk map definition, sometime you might require to read some configuration value. For example

  3. menin says:

    i tried this but it gives me Object refrence error,i found that there are limited number of namespaces allowed in Inline C#, does System.configuration allowed in script functiod

  4. Kelvin says:


       First of all, Thank you giving ideas in blogs.I got to know how i can pass connection string now. But is it not possible if we dont used this scripting Functoid where it has declare"System.Configuration.ConfigurationSettings.AppSettings.Get("CONNSTR").ToString();" If, Yes, Can you tell us how we can go for that.

Skip to main content