asp.net - 本地主机找不到存储过程 'dbo.aspnet_CheckSchemaVersion'

标签 asp.net sql sql-server iis-7 localhost

我已经查看了所有内容,但似乎找不到此错误的答案:

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

我正在从一个空的 Web 项目编写一个 ASP.NET 应用程序,并尝试向该应用程序添加角色/成员身份。我自己制作了登录/注销页面,但我使用的是预制的“登录”工具。我使用的数据库是我自己的数据库实例“帐户”,它使用 Windows 身份验证。当我处于 Debug模式时,我可以正常登录!但是当我推送到本地主机时,我收到此错误。在我展示所有代码/堆栈跟踪/等之前。让我列出到目前为止我所做的事情:

  1. 已经从 V4 和 V2 文件夹多次运行 aspnet_regsql.exe,以防我错过任何内容(因为我发现的此错误的所有帮助都在 V2 中)

  2. 我检查了 IIS 中的应用程序池,将其从“applicationpoolidentity”切换为“网络服务”,因为我在“applicationpoolidentity”时收到此错误

System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\DefaultAppPool'.

  • 我尝试重新启动计算机

  • 我尝试卸载/重新安装 VS2012 和 SQL Server 2008 R2

  • 我多次操作 web.config,但没有成功

  • 我检查连接字符串

  • 我尝试启动 MSSQL 服务(我自己的实例和 SQLEXPRESS)

  • 我已尝试在 IIS 中重新启动站点

  • 我没有主意了。话虽如此,这里是代码/堆栈跟踪/等:

    网络配置:

    <configuration>
      <connectionStrings>
        <remove name="AccountsConnectionString"/>
        <add name="AccountsConnectionString" connectionString="Data Source=development;Initial Catalog=Accounts;Integrated Security=True" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <system.web>
    
        <authentication mode="Forms"/>
    
        <roleManager enabled="true" defaultProvider="SqlRoleProvider">
          <providers>
            <clear/>
            <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="AccountsConnectionString"  />
          </providers>
        </roleManager>
    
        <membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="1500">
          <providers>
            <remove name="SqlMembershipProvider"/>
            <add name="SqlMembershipProvider" 
                 type="System.Web.Security.SqlMembershipProvider" 
                 connectionStringName="AccountsConnectionString" 
                 enablePasswordRetrieval="false" 
                 enablePasswordReset="true" 
                 requiresQuestionAndAnswer="false" 
                 requiresUniqueEmail="false" 
                 applicationName="ConsultDemo"
                 minRequiredNonalphanumericCharacters="0"
                 minRequiredPasswordLength="5"/>
          </providers>
        </membership>
    
        <profile enabled="true" defaultProvider="SqlProfileProvider">
          <providers>
            <clear/>
            <add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="AccountsConnectionString" />
          </providers>
        </profile>
    
        <compilation debug="true" targetFramework="4.0"/>
      </system.web>
    </configuration>
    

    堆栈跟踪:

    [SqlException (0x80131904): Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +688
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4403
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6665097
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +6667096
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +577
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +735
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +290
       System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +623
       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) +3888825
       System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +186
       System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +195
       System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +105
       System.Web.UI.WebControls.Login.AttemptLogin() +160
       System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +93
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +84
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
    

    显示架构和存储过程的图片实际上已就位:

    Picture to show the schema and stored procedure is infact in place

    感谢任何帮助!如果我可能错过了答案,请指出我。我试图让它在本地主机上运行......但没有任何效果!提前谢谢大家。

    最佳答案

    请为您的连接字符串提供UserIDPassword。它不存在于连接字符串中。

    关于asp.net - 本地主机找不到存储过程 'dbo.aspnet_CheckSchemaVersion',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20987079/

    相关文章:

    c# - 在 Membership.ValidateUser(string userName, string password) 中使用 SecureString

    asp.net - 是否可以将 asp.net MVC 托管在与 asp.net Web 表单应用程序相同的文件夹中?

    sql - 如何获取 PostgreSQL 序列中的下一个数字

    php - 在php中将多行插入sql数据库

    sql - 在自引用表 SQL Server 上查找最高祖 parent

    c# - 如何将日期时间插入时间(0)字段

    c# - 禁用页面上的多个按钮控件

    C# Dll导入麻烦

    mysql - 获取特定字段数据备份以及mysql中的更新查询

    mysql - 避免在 MySQL 中对两个几乎相同的表使用 UNION