Announcement

Collapse
No announcement yet.

Frage zu Configuration Application Block

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frage zu Configuration Application Block

    Hallo NG

    Ich glaube, langsam begreiffe ich das Teil.
    Beim Testen bin ich jetzt aber auf ein Prob. gestossen.

    Die Settings, die ich speichern möchte, kommen ja in ein XML File.
    Die Datei wird mir auch vom ELC erstellt. Allerdings ist da kein XML Rumpf
    drin. Die Beispiele, die ich finde, gehen immer (jedenfals meine ich das)
    davon aus, dass der Rumpf besteht.

    Muss ich den Rumpf des XML Files, wo die Daten rein sollen, wirklich von
    Hand erstellen?
    Laden täte ich das ja so.

    C#-Code:
    \
    private void frmMain_Load(object sender, System.EventArgs e)
    {
    try
    {
    SC.Settings = ConfigurationManager.GetConfiguration("ProSaSoftSe tings") as Settings;
    }
    catch
    {
    SC.Settings = new Settings();
    ConfigurationManager.WriteConfiguratio("ProSaSoftS ettings", SC.Settings);
    }
    }
    ///


    Nur, wenn das XML File leer ist laufe ich da auf einen Fehler. Das könnte
    man ja dazu nutzen, um das XML geleich zu erstellen. Genau da habe ich
    jetzt ein Problem. Auch hier kommt ein Fehler weil der Rumpf des XML noch nicht besteht.

    \\\
    Zusätzliche Informationen: Invalid section name. The section
    'ProSaSoftSettings' does not exist in the requested configuration file
    'D:\Entwicklung\ProSaSoft\ProSaSoft\bin\Debug\ProS aSoft.exe.config' or the
    file 'c:\windows\microsoft.net\framework\v1.1.4322\Conf ig\machine.config'.
    Make sure that the 'enterpriseLibrary.configurationSections' configuration
    section exists in one of the files and that the section 'ProSaSoftSettings'
    is defined.
    ///

    Wie könnte ich also via Code den Rumpf erstellen?

  • #2
    Hallo

    Der Fehler lag bei mir. Ich habe bei der Definition im ELC ProSaSoftSetting nur mit einem t geschrieben. So blöd. :-

    Comment

    Working...
    X