您好我的连接字符串有问题:
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<customErrors defaultRedirect="~/error.aspx" mode="RemoteOnly"/>
<authentication mode="Forms">
<forms loginUrl="~/login.aspx" />
</authentication>
<authorization>
<allow users="*" />
</authorization>
<roleManager enabled="true" />
<compilation debug="true" />
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
</system.web>
<location path="~/securepage.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>
任何人都可以告诉我问题是否会出现?我不知道问题是否来自 add name =“ApplicationServices”。 我将非常感谢你的帮助
答案 0 :(得分:4)
您引用了不存在的connectionStringName="LocalSqlServer"
。您注册的两个连接字符串是ApplicationServices
和ConnectionString
。
将您的第二个连接字符串条目重命名为:
<add name="LocalSqlServer" ...