configuration from web.config doesn't override app.config

2 posts, 0 answers
  1. Devanand Chahal
    Devanand Chahal avatar
    26 posts
    Member since:
    Mar 2009

    Posted 05 Oct 2009 Link to this post


    We have a connection string tag in each of the app.config  of the project and in web.config file. Now during the deployement we change the connection string as per the new environment in the web.config. Ideally the connection setting in web.config should override the the connection settings for all the DLLs, but this is not happening currently. We have  to change the connection string for each project in app.config and compile , to make it work.

    Please let us know if any settings needs to checked foropwn access , that will automatically override the connection string from web.config.
  2. PetarP
    PetarP avatar
    754 posts

    Posted 07 Oct 2009 Link to this post

    Hello Devanand Chahal,

    You do not need the connection nodes anymore in the app.config files. Just create a <connections> section in the Web.config and move there the <connection> nodes from the app.config files. Please make sure that if an assembly needs the Update Database property set to True, you should enable this option for the Web project and disable it for the class library. The point is that the UpdateDatabase property should be set only for the project, containing the connection settings. 
    Note that the other assemblies should still hold the definitions of your persistent classes.
    Please also verify that you have references to the compiled assemblies in the web.config. The reference section should look something like this:
        <reference assemblyname="ClassLibrary1" configrequired="True"/>  
        <reference assemblyname="ClassLibrary2" configrequired="True"/>  
    If you do not have such node, run the Enable project wizard for the web site and it will be automatically created.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top