asp.netアプリケーションのメンバーシッププロバイダからいくつかの設定を取得しようとしていますappSettingsセクションにある情報を複製する)が、私は次の例外を取得しています:web.configからセクションを開こうとすると、ConfigurationErrorsExceptionが発生します。既にエントリKEYが追加されています
var configurationManager = WebConfigurationManager.OpenWebConfiguration("/", "IntranetWebapp");
var section = (MembershipSection) configurationManager.GetSection("system.web/membership");
例外が2行目に発生します
System.Configuration.ConfigurationErrorsException: The entry 'MyMembershipProvider' has already been added. (C:\Inetpub\intranet-webapp\web.config line 53)
私のコードは次のようです。 configファイルに新しい情報を追加しようとしているわけではないので、私はそれが完全に奇妙であると感じます。代わりに、私はそれを取得しようとしています。私のconfigセクションの
内容:すべてのヘルプははるかに高く評価されて
<membership defaultProvider="IntranetApp">
<providers>
<add applicationName="IntranetApp"
enableSearchMethods="true"
connectionStringName="IntranetConnectionString"
connectionUsername="CN=username,OU=Service Accounts,OU=Users,OU=CompanyName,DC=CompanyName,DC=com"
connectionPassword="********"
name="MyIntranetMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider" />
</providers>
</membership>
。人口セクションの変数としてで結果を(明らかにサイトのプロパティに異なる値で)まったく同じことを使用して - 、私はあなたのコードに何かを見ることができない私のコメントからの修正を想定すると、
パブロ
問題のConfigセクションの内容を投稿できますか? –
@Zhaphは役に立つかどうかわかりませんが、ここには... – Pablo
2番目の行は読まないでください:var section =(MembershipSection)configurationManager.GetSection( "system.web/membership") ;? –