ASP.NET - Web.config 登录错误找不到存储过程 'dbo.aspnet_CheckSchemaVersion'

标签 asp.net authentication web-config forms-authentication

我正在使用表单例份验证并收到以下错误:

Server Error in '/' Application.

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +392
System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +84
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +827
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +106
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129 System.Web.UI.WebControls.Login.AttemptLogin() +127
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

这是我的 web.config 文件中的代码:

<?xml version="1.0"?>

<configuration>
<connectionStrings>
    <add name="OleConnectionStringSource" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;User ID=PriceFinderUser;Password=******;Integrated Security=false"
     providerName="System.Data.SqlClient" />
    <add name="OleConnectionStringTarget" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;User ID=PriceFinderUser;Password=******;Integrated Security=false"
     providerName="System.Data.OleDb;" />
    <add name="PriceFinderConnectionString" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;Integrated Security=True"
     providerName="System.Data.SqlClient" />
    <add name="PriceFinderConnectionString2" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;Integrated Security=True"
     providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<compilation debug="true" targetFramework="4.0" />

<authentication mode="Forms">
  <forms loginUrl="~/default.aspx" timeout="2880" />
</authentication>

 <membership>
  <providers>
    <clear/>
      <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="OleConnectionStringSource"
         enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
         maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
         applicationName="/" />  
  </providers>
</membership> 

<profile>
  <providers>
    <clear/>
   <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
  </providers>
</profile>

<roleManager enabled="false">
  <providers>
    <clear/>
      <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
  </providers>
</roleManager>

如何修复这个错误?您需要查看其他文件吗? 谢谢!

最佳答案

您是否在 SQL-Server 中创建了表和存储过程?

看看this link如果您使用 MS Sql-Server 作为 DBMS,请执行 aspnet_regsql.exe

关于ASP.NET - Web.config 登录错误找不到存储过程 'dbo.aspnet_CheckSchemaVersion',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5223835/

相关文章:

php - 如何在php中设置访问权限以查看页面

c# - WCF REST 服务模板 40(CS) 跨域错误

visual-studio - Visual Studio 2010 - 配置转换不起作用,未添加自定义构建配置

javascript - JQuery 对话框 - 仅在单击按钮时加载

java - 如何在 Java 中明智地绕过 SSL 身份验证 URL 连接?

asp.net - Google Adwords 跟踪 cookie 触发 ASP.NET 请求验证异常

c - 用户使用 wtmp 在线花费的时间

ASP.NET/Web.config : customErrors redirect only on a 404

c# - 无法更改文本框属性

javascript - 在 asp.net MVC 中提交局部 View 时如何显示加载微调器?