localhost无法找到存储过程'dbo.aspnet_CheckSchemaVersion'

时间:2014-01-08 04:30:22

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

我看了一遍,似乎找不到这个错误的答案:

  

无法找到存储过程'dbo.aspnet_CheckSchemaVersion'。

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

  1. HAVE 多次从V4和V2文件夹运行aspnet_regsql.exe只是因为我错过了任何东西(因为我发现的这个错误的所有帮助都是在V2中)

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

  3.   

    System.Data.SqlClient.SqlException:用户'IIS登录失败   APPPOOL \默认应用”。

    1. 我尝试重新启动计算机

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

    3. 我多次操纵web.config而没有运气

    4. 我检查连接字符串

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

    6. 我尝试在IIS中重新启动网站

    7. 我没有想法。所有这些都说,这是代码/堆栈跟踪/等等:

      的web.config:

      <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

      任何帮助表示赞赏!如果有一个我可能错过的答案,请指出我。我试图让它在localhost上运行......没有任何工作!提前谢谢大家。

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

从OP的评论中解释@RonakBhatt:

即使您使用的是Windows身份验证,也请使用SQL身份验证创建用户,并将这些凭据添加到连接字符串中。

感谢@RonakBhatt指出这一点。我想仍然可以通过Windows身份验证连接

答案 2 :(得分:0)

我遇到同样的问题 - 我在Visual Studio中从SQL Object manager复制/粘贴connectionString,忘记输入Initial Catalog=YourDatabaseName