locked
How to use App.config in BizTalk and C# class library RRS feed

  • Question

  • Hello,

      I have a following scenario

    1. I have a BizTalk application

    2. I have a C# Class library which will be consumed by the BizTalk

     

    I wanted to use the Microsoft Enterprise Library for Exception handing. This requires an App.Config file. I also have some application parameters in app.Config.

    How can i load this App.Congif in C# library?

    If I add the App.config in the BizTalk project will the C# class take the app.config from the BizTalk project?

     

    Can any one guide me in this

     

    Cheers,

    Karthik

    Tuesday, January 4, 2011 11:40 AM

Answers

  • Karthik

    YOu can store the configuration parameter in the Default configuration file of Biztalk (Btsvc.exe.config) which can be found under "C:\Program File\Biztalk Server <Version>/".And in the C# library access the Parameters.

     

    Regards

    Deepak Sanghi


    Deepak Sanghi Happy Biztalking.........
    Tuesday, January 4, 2011 12:04 PM
  • Hi,

    In addition, here are just a few remarks:

      - If you have a 64 bit host, be sure to also use the BtsNtSvc64.exe.config 

      - If your assembly can be called in a receive pipeline associated with a HTTP, WCF or SOAP receive location, be sure to put your config into the w3wp.exe.config.

    Bye.


    David GROSPELIER NOVELI MVP BizTalk 2010 dgr@noveli.fr http://blog.noveli.fr
    Tuesday, January 4, 2011 1:08 PM
  • I would recommend create a schema for your configuration, serialize it, store it in SSO. In runtime, maintain a cache in the memory. I would not touch the BizTalk configuration file since it is not a good practice especially in a multi-server deployment. If you need to use enterprise library, I say store the connection string in SSO, use sql configuration source. I personally do not like the idea store the config data in BRE, except it does change frequently.

    Tuesday, January 4, 2011 5:35 PM

All replies

  • Karthik

    YOu can store the configuration parameter in the Default configuration file of Biztalk (Btsvc.exe.config) which can be found under "C:\Program File\Biztalk Server <Version>/".And in the C# library access the Parameters.

     

    Regards

    Deepak Sanghi


    Deepak Sanghi Happy Biztalking.........
    Tuesday, January 4, 2011 12:04 PM
  • Thanks Deepak for the answer. Isn't there any other way to load the app.config in the c# class  library?

    There can be more than one BizTalk application loaded and if i store the config under Btsvc.exe.config the same configu would be used for all right?

    I am targeting  the logging only my application

    Thanks

    Cheers,

    Karthik

    Tuesday, January 4, 2011 12:12 PM
  • Karthik

    As per my understanding,You want to do only logging for your application.And for this Suppose you are storing some parameters in Btsvc.exe.config.As we know this file will be shared for all the Biztalk Application.But the application for which you want to logging will access those patrameter only,rest application would not access it.So i think keeping the Parameters in Btsvc.exe.config will be ok.Using Custom config file for biztalk is least prefeered approach.

    Apart from this you can use

    1)SSO

    2)BRE

    3)Custom Database.

    You can use following link

    http://geekswithblogs.net/michaelstephenson/archive/2008/05/25/122381.aspx

     

    Regards

    Deepak Sanghi


    Deepak Sanghi Happy Biztalking.........
    Tuesday, January 4, 2011 12:27 PM
  • Thanks. Let me check this

     

    Tuesday, January 4, 2011 1:04 PM
  • Hi,

    In addition, here are just a few remarks:

      - If you have a 64 bit host, be sure to also use the BtsNtSvc64.exe.config 

      - If your assembly can be called in a receive pipeline associated with a HTTP, WCF or SOAP receive location, be sure to put your config into the w3wp.exe.config.

    Bye.


    David GROSPELIER NOVELI MVP BizTalk 2010 dgr@noveli.fr http://blog.noveli.fr
    Tuesday, January 4, 2011 1:08 PM
  • Thanks David

     

    i was wondering if there could be any easy solution for this. I am not sure if would get access to modify the BtsNtSvc64.exe.config or Btsvc.exe.config in prdocution

    My idea was that i have an AppConfig for class library but that doesn't seem to work

    Also i was thinking if I could add the App.Config for my Biztalk app project. Would that work?

    Tuesday, January 4, 2011 1:34 PM
  • In one of my previous projects I created one appsetting for each application in the BTS config file which contained path to an xml file. This xml file would contain settings specific to each application.

    Tuesday, January 4, 2011 4:25 PM
  • In one of my previous projects I created one appsetting for each application in the BTS config file which contained path to an xml file. This xml file would contain settings specific to each application.

    Could you give me more details on this? some sample code ? would be really great
    Tuesday, January 4, 2011 4:54 PM
  • Hi Karthik,

    • If you are using C# Class component in BizTalk then you have to use BTSNTSvc.config file for any kinds of configuration.
    • there are ways which lets you keep your configuration separate  for each application . There is a concept called AppDomains configurations in BizTalk Configuration file which will help you solving your problem. Please see this link for more detail about configuring AppDomains specific in BTSNTSVCConfig.exe

    Thanks

    Naushad


    MCTS BizTalk Server http://alamnaushad.wordpress.com/ If this answers your question please mark.
    Tuesday, January 4, 2011 4:59 PM
    Moderator
  • I would recommend create a schema for your configuration, serialize it, store it in SSO. In runtime, maintain a cache in the memory. I would not touch the BizTalk configuration file since it is not a good practice especially in a multi-server deployment. If you need to use enterprise library, I say store the connection string in SSO, use sql configuration source. I personally do not like the idea store the config data in BRE, except it does change frequently.

    Tuesday, January 4, 2011 5:35 PM
  • Karthick,

    If you want to have your own Config File and not use the BtsNtsvc64.exe.Config or Btsvc.exe.config, you can very well use the ExeConfigurationFileMap class to access your Own config File.

    Please refer to http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.openmappedexeconfiguration%28v=VS.90%29.aspx

    The above link in MSDN provides Sample Code Snippet to access define and use a custom configuration file.


    Sathish - http://blog.tsathish.com - Please Indicate "Mark as Answer" if this Post has Answered the Question
    • Proposed as answer by SathishT Tuesday, January 4, 2011 11:38 PM
    Tuesday, January 4, 2011 5:55 PM
  • You can use this http://seroter.wordpress.com/2007/09/21/biztalk-sso-configuration-data-storage-tool/ "BizTalk SSO Configuration Data Storage Tool" by Richard Seroter. It works fine!
    Leonid Ganeline [BizTalk MVP] BizTalk: History of one project architecture
    Tuesday, January 4, 2011 10:36 PM
    Moderator
  • Thanks guys for your replies.

    But I am still not convinced on how i could use the EnterpriseLibrary  in my  Class file and make it to take the configuration from any one of the methods mentioned above except for modifying the BtsNtsvc64.exe.Config or Btsvc.exe.config

     

    I am still exploring the options.

    Cheers,

    Karthik

    Wednesday, January 5, 2011 10:56 AM
  • Finally i have decided to modify BizTalk's appconifg

     

    Thanks for all your suggestions and help

     

    Cheers,

    Karthik

    Tuesday, January 11, 2011 2:02 PM