App.Config File

Discussion in 'ASP .Net' started by Stephen, Jan 23, 2006.

  1. Stephen

    Stephen Guest

    Hi,

    I did mange to create custom app.config file for a windows based
    application.
    I am trying to use the same process to use the app.config file for a console
    based application but i get this error message: when i pass parameter
    "stage" from the app.config file


    ExceptionMessage:System.Configuration.ConfigurationException: Could not
    create System.Configuration.NameValueFileSectionHandler,
    System, Version=1.0.5000.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089
    at System.Configuration.ConfigurationRecord.GetFactory(String configKey)
    at System.Configuration.ConfigurationRecord.Evaluate(String configKey)
    at System.Configuration.ConfigurationRecord.ResolveConfig(String
    configKey)
    at System.Configuration.ConfigurationRecord.GetConfig(String configKey)
    at
    System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfig
    urationSystem.GetConfig(String configKey)
    at System.Configuration.ConfigurationSettings.GetConfig(String
    sectionName)
    at TestConsoleApp.TestConsoleApp.getFilePaths() in
    C:\......\TestConsoleApp\TestConsoleApp.vb:line 41

    I am using this app.config file:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    <section name="dev"
    type="System.Configuration.NameValueFileSectionHandler,
    System, Version=1.0.5000.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"/>
    <section name="stage"
    type="System.Configuration.NameValueFileSectionHandler,
    System, Version=1.0.5000.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"/>
    <section name="prod"
    type="System.Configuration.NameValueFileSectionHandler,
    System, Version=1.0.5000.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"/>

    </configSections>

    <dev>
    <add key="AppRootDir" value="/Authoring/"/>
    </dev>

    <stage>
    <add key="AppRootDir" value="/S-Authoring/"/>
    </stage>

    <prod>
    <add key="AppRootDir" value="/P-Authoring/"/>
    </prod>

    </configuration>

    Thanks,
    Stephen
     
    Stephen, Jan 23, 2006
    #1
    1. Advertising

  2. Stephen

    Stephen Guest

    Found the solution,
    Thanks guys
    Stephen

    "Stephen" <> wrote in message
    news:...
    > Hi,
    >
    > I did mange to create custom app.config file for a windows based
    > application.
    > I am trying to use the same process to use the app.config file for a

    console
    > based application but i get this error message: when i pass parameter
    > "stage" from the app.config file
    >
    >
    > ExceptionMessage:System.Configuration.ConfigurationException: Could not
    > create System.Configuration.NameValueFileSectionHandler,
    > System, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b77a5c561934e089
    > at System.Configuration.ConfigurationRecord.GetFactory(String

    configKey)
    > at System.Configuration.ConfigurationRecord.Evaluate(String configKey)
    > at System.Configuration.ConfigurationRecord.ResolveConfig(String
    > configKey)
    > at System.Configuration.ConfigurationRecord.GetConfig(String configKey)
    > at
    >

    System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfig
    > urationSystem.GetConfig(String configKey)
    > at System.Configuration.ConfigurationSettings.GetConfig(String
    > sectionName)
    > at TestConsoleApp.TestConsoleApp.getFilePaths() in
    > C:\......\TestConsoleApp\TestConsoleApp.vb:line 41
    >
    > I am using this app.config file:
    >
    > <?xml version="1.0" encoding="utf-8" ?>
    > <configuration>
    > <configSections>
    > <section name="dev"
    > type="System.Configuration.NameValueFileSectionHandler,
    > System, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b77a5c561934e089"/>
    > <section name="stage"
    > type="System.Configuration.NameValueFileSectionHandler,
    > System, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b77a5c561934e089"/>
    > <section name="prod"
    > type="System.Configuration.NameValueFileSectionHandler,
    > System, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b77a5c561934e089"/>
    >
    > </configSections>
    >
    > <dev>
    > <add key="AppRootDir" value="/Authoring/"/>
    > </dev>
    >
    > <stage>
    > <add key="AppRootDir" value="/S-Authoring/"/>
    > </stage>
    >
    > <prod>
    > <add key="AppRootDir" value="/P-Authoring/"/>
    > </prod>
    >
    > </configuration>
    >
    > Thanks,
    > Stephen
    >
    >
     
    Stephen, Jan 23, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ad
    Replies:
    1
    Views:
    3,745
    Christopher Reed
    Mar 30, 2006
  2. Replies:
    4
    Views:
    10,328
    Kevin Spencer
    Apr 5, 2006
  3. CSharpner
    Replies:
    0
    Views:
    1,109
    CSharpner
    Apr 9, 2007
  4. vbjohn
    Replies:
    0
    Views:
    549
    vbjohn
    Jan 29, 2008
  5. leeanne
    Replies:
    0
    Views:
    1,913
    leeanne
    Sep 24, 2008
Loading...

Share This Page