私はapp.configファイルを使用していくつかのパラメータを保存しようとしていますが、私はappSettingsにアクセスしようとするとSystem.Configuration.ConfigurationException : Configuration system failed to initialize
を取得し続けます。ここでApp.config例外:構成システムの初期化に失敗しました
は私のApp.configファイルである:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<appSettings>
<add key="test" value="1" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
そして、ここでは、私は自分のデータとどこ私は例外を取得にアクセスしようとする方法は次のとおりです。
string test = ConfigurationManager.AppSettings["test"];
私は問題から来ることができました<configSections>
(ここでは該当しません)または.NETバージョン(私は4.5.1を使用していますので、あまりにも良いと思われます)。
私はちょうどそれを振ることはできません、任意の助けに感謝します。
実際にアプリケーション設定セクションに '...'がありますか? – Yarimi
もちろん、私は多くのパラメータを持っているだけですが、私の会社固有のものなので表示できません。私は混乱を避けるためにそれらを取り除きます。 –