Application Blocks (XML File) Configuration Manager

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee Connell

    Application Blocks (XML File) Configuration Manager

    Hello,

    I am trying to use the Application blocks configuration manager. I am
    reading the docs on how to setup the app.config file to use the proper
    reader/writer. I want to use xml file. I followed the directions and I am
    still getting an error in the app.config file, it's complaining about
    "Unrecogniz ed configuration section", "applicationCon figurationManag ement".

    Here is the app.config file declaration as the docs say:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuratio n>
    <applicationCon figurationManag ement defaultSection= "TestConfigSect ion">
    <configSectio n name="TestConfi gSection">

    <configProvid er
    assembly="Micro soft.Applicatio nBlocks.Configu rationManagemen t.Storage.XmlFi l
    eStorage" path="C:\\Docum ents and Settings\\Lee Connell\\My
    Documents\\Visu al Studio Projects\\Confi gTest\\ConfigTe st.xml"
    refreshOnChange ="true" signed="false" encrypted="fals e"/>

    </configSection>
    </applicationConf igurationManage ment>
    </configuration>

    What am I missing to use this correctly?

    Thank you


  • Lee Connell

    #2
    Re: Application Blocks (XML File) Configuration Manager

    I have tried the following also. I am pretty aggrivated right now because I
    don't believe it is clear enough on how to set this. It could also be my
    lack of xml xsd knowledge.

    <?xml version="1.0" encoding="utf-8" ?>

    <configuratio n>

    <configSections >

    <section name="applicati onConfiguration Management"
    type="System.Co nfiguration.Nam eValueSectionHa ndler,System.Co nfiguration,Ver s
    ion=1.0.0.0,Cul ture=neutral,Pu blicKeyToken=nu ll"/>

    </configSections>


    <applicationCon figurationManag ement defaultSection= "TestConfigSect ion">

    <configSectio n name="TestConfi gSection">

    <configProvid er
    assembly="Micro soft.Applicatio nBlocks.Configu rationManagemen t.Storage.XmlFi l
    eStorage" path="C:\\Docum ents and Settings\\Lee Connell\\My
    Documents\\Visu al Studio Projects\\Confi gTest\\ConfigTe st.xml"
    refreshOnChange ="true" signed="false" encrypted="fals e"/>

    </configSection>

    </applicationConf igurationManage ment>

    </configuration>


    Comment

    • Allen Jones

      #3
      Re: Application Blocks (XML File) Configuration Manager

      Sorry Lee,

      I cant see the rest of the thread, so I dont have a clue what problem you
      are seeing. But from the look of the XML config file you have shown, your
      <configProvider > element is missing a "type" attribute, which tells CMAB the
      name of the provider class.

      Try:

      type="Microsoft .ApplicationBlo cks.Configurati onManagement.St orage.XmlFileSt o
      rage"

      Also not sure if you need the "\\" in your path attribute or just "\" - cant
      remember.

      Regards
      Allen


      "Lee Connell" <leeconnell@ade lphia.net> wrote in message
      news:OJd7OjrTDH A.3800@tk2msftn gp13.phx.gbl...[color=blue]
      > I have tried the following also. I am pretty aggrivated right now because[/color]
      I[color=blue]
      > don't believe it is clear enough on how to set this. It could also be my
      > lack of xml xsd knowledge.
      >
      > <?xml version="1.0" encoding="utf-8" ?>
      >
      > <configuratio n>
      >
      > <configSections >
      >
      > <section name="applicati onConfiguration Management"
      >[/color]
      type="System.Co nfiguration.Nam eValueSectionHa ndler,System.Co nfiguration,Ver s[color=blue]
      > ion=1.0.0.0,Cul ture=neutral,Pu blicKeyToken=nu ll"/>
      >
      > </configSections>
      >
      >
      > <applicationCon figurationManag ement defaultSection= "TestConfigSect ion">
      >
      > <configSectio n name="TestConfi gSection">
      >
      > <configProvid er
      >[/color]
      assembly="Micro soft.Applicatio nBlocks.Configu rationManagemen t.Storage.XmlFi l[color=blue]
      > eStorage" path="C:\\Docum ents and Settings\\Lee Connell\\My
      > Documents\\Visu al Studio Projects\\Confi gTest\\ConfigTe st.xml"
      > refreshOnChange ="true" signed="false" encrypted="fals e"/>
      >
      > </configSection>
      >
      > </applicationConf igurationManage ment>
      >
      > </configuration>
      >
      >[/color]


      Comment

      • Lee Connell

        #4
        Re: Application Blocks (XML File) Configuration Manager

        Hi Allen,

        I sent you an email also, I don't know what you can't see?

        Here is the config file I've been trying to get to work.

        This is the "App.Config " file:

        <?xml version="1.0" encoding="utf-8" ?>
        <configuratio n>

        <configSections >

        <section

        name="applicati onConfiguration Management"

        type="Microsoft .ApplicationBlo cks.Configurati onManagement.Co nfigurationMana g
        erSectionHandle r,Microsoft.App licationBlocks. ConfigurationMa nagement,
        Version=1.0.0.0 ,Culture=neutra l,PublicKeyToke n=null"/>

        </configSections>


        <applicationCon figurationManag ement defaultSection= "TestConfigSect ion">

        <configSectio n name="TestConfi gSection">

        <configProvid er

        assembly="Micro soft.Applicatio nBlocks.Configu rationManagemen t,Version=1.0.0 .
        0,Culture=neutr al,PublicKeyTok en=null"

        type="Microsoft .ApplicationBlo cks.Configurati onManagement.St orage.XmlFileSt o
        rage"

        path="C:\\Docum ents and Settings\\Lee Connell\\My Documents\\Visu al Studio
        Projects\\Confi gTest\\ConfigTe st.xml"

        refreshOnChange ="true"

        signed="false"

        encrypted="fals e"/>

        </configSection>

        </applicationConf igurationManage ment>

        </configuration>

        Here is the "ConfigTest.xml " file I want to use to read and write values to:

        <?xml version="1.0" encoding="utf-8" ?>

        <configuratio n>

        <TestConfigSect ion>

        </TestConfigSecti on>

        </configuration>




        Comment

        • Allen Jones

          #5
          Re: Application Blocks (XML File) Configuration Manager

          And what is happening when you try to use these files?

          Regards
          Allen

          "Lee Connell" <leeconnell@ade lphia.net> wrote in message
          news:ukafq4uTDH A.1740@TK2MSFTN GP12.phx.gbl...[color=blue]
          > Hi Allen,
          >
          > I sent you an email also, I don't know what you can't see?
          >
          > Here is the config file I've been trying to get to work.
          >
          > This is the "App.Config " file:
          >
          > <?xml version="1.0" encoding="utf-8" ?>
          > <configuratio n>
          >
          > <configSections >
          >
          > <section
          >
          > name="applicati onConfiguration Management"
          >
          >[/color]
          type="Microsoft .ApplicationBlo cks.Configurati onManagement.Co nfigurationMana g[color=blue]
          > erSectionHandle r,Microsoft.App licationBlocks. ConfigurationMa nagement,
          > Version=1.0.0.0 ,Culture=neutra l,PublicKeyToke n=null"/>
          >
          > </configSections>
          >
          >
          > <applicationCon figurationManag ement defaultSection= "TestConfigSect ion">
          >
          > <configSectio n name="TestConfi gSection">
          >
          > <configProvid er
          >
          >[/color]
          assembly="Micro soft.Applicatio nBlocks.Configu rationManagemen t,Version=1.0.0 .[color=blue]
          > 0,Culture=neutr al,PublicKeyTok en=null"
          >
          >[/color]
          type="Microsoft .ApplicationBlo cks.Configurati onManagement.St orage.XmlFileSt o[color=blue]
          > rage"
          >
          > path="C:\\Docum ents and Settings\\Lee Connell\\My Documents\\Visu al Studio
          > Projects\\Confi gTest\\ConfigTe st.xml"
          >
          > refreshOnChange ="true"
          >
          > signed="false"
          >
          > encrypted="fals e"/>
          >
          > </configSection>
          >
          > </applicationConf igurationManage ment>
          >
          > </configuration>
          >
          > Here is the "ConfigTest.xml " file I want to use to read and write values[/color]
          to:[color=blue]
          >
          > <?xml version="1.0" encoding="utf-8" ?>
          >
          > <configuratio n>
          >
          > <TestConfigSect ion>
          >
          > </TestConfigSecti on>
          >
          > </configuration>
          >
          >
          >
          >[/color]


          Comment

          • Allen Jones

            #6
            Re: Application Blocks (XML File) Configuration Manager

            Lee,

            Add a <section> element for the TestConfigSecti on to the <configSections >
            element of your application's config file, so it should look like this.


            <configSections >

            <section name="applicati onConfiguration Management"
            type="System.Co nfiguration.Nam eValueSectionHa ndler,System.Co nfiguration,Ver s
            ion=1.0.0.0,Cul ture=neutral,Pu blicKeyToken=nu ll"/>

            <section name="TestConfi gSection"
            type="Microsoft .ApplicationBlo cks.Configurati onManagement.Xm lHashtableSecti o
            nHandler,Micros oft.Application Blocks.Configur ationManagement ,
            Version=1.0.0.0 ,Culture=neutra l,PublicKeyToke n=null" />

            </configSections>

            Regards
            Allen


            "Lee Connell" <leeconnell@ade lphia.net> wrote in message
            news:%23r1y7GvT DHA.872@TK2MSFT NGP12.phx.gbl.. .
            [color=blue]
            > Initialize() works fine but when i try to add something to the file I get
            > this error:
            >
            > Additional information: Section 'TestConfigSect ion' not defined on the
            > configuration file. Check the /configuration/configSections/section node[/color]
            in[color=blue]
            > the application config file (assemblyfilena me.config). This node must be
            > like <section name="XmlConfig " type="WinApp.Cu stomSectionHand ler,WinApp"[/color]
            />.[color=blue]
            >
            > using this code:
            >
            > ConfigurationMa nager.Initializ e();
            >
            > tbl = new Hashtable();
            >
            > tbl.Add("testke y", "testvalue" );
            >
            > ConfigurationMa nager.Write(tbl );
            >
            >[/color]


            Comment

            • Lee Connell

              #7
              Re: Application Blocks (XML File) Configuration Manager

              THANKYOU Allen! Everything runs fine now :) I really appreciate your time.

              Lee


              Comment

              Working...