我有一个WPF表单,我正在尝试使用我们设置的SQL成员资格提供程序。我的App.Config看起来像这样:
<?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>
当我调试时,我有一个断点:
string thisrsgjha = Membership.Provider.ApplicationName;
当我钻进Provider(使用监视窗口)时,我看到它在本地使用SQL连接字符串而不是我在App.Config中定义的连接字符串。我错过了什么吗?这在我们也有的Web应用程序中完美地工作,但不是在这里。
答案 0 :(得分:0)
确保配置文件已正确部署在输出目录中。