C# WPF不尊重App.config中的SQL连接和成员资格提供程序
我有一个WPF表单,我正试图与我们设置的SQL成员资格提供程序一起使用。我的App.Config如下所示:C# WPF不尊重App.config中的SQL连接和成员资格提供程序,c#,wpf,sqlmembershipprovider,C#,Wpf,Sqlmembershipprovider,我有一个WPF表单,我正试图与我们设置的SQL成员资格提供程序一起使用。我的App.Config如下所示: <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <clear/> <add name="IodConnString" connectionString="server=SQLSERVER;UID=USER;PW
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<clear/>
<add name="IodConnString" connectionString="server=SQLSERVER;UID=USER;PWD=PASSWORD;DATABASE=DATABASE;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!-- membership provider -->
<membership defaultProvider="IODMembershipProvider">
<providers>
<clear/>
<add name="IODMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="IodConnString"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Clear"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="3"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
</system.web>
</configuration>
当我深入到提供程序(使用“监视窗口”)时,我看到它在本地使用SQL连接字符串,而不是我在App.Config中定义的连接字符串。我错过什么了吗?这在我们也有的Web应用程序中非常有效,但这里没有。请确保配置文件正确部署在输出目录中。嗯,我想您已经了解了一些情况,我添加了一个appSetting部分,其中的关键用户名值为“Dan”。当我试图读取该密钥时,我得到空值。我添加了对System.configuration的引用,并添加了using System.configuration;还有什么是我遗漏的吗?App.config的构建操作是什么?
string thisrsgjha = Membership.Provider.ApplicationName;