Could not find stored procedure "dbo.aspnet_CheckSchemaVersion"

I use WinHost.com to host my site. The SQL / Membership database system works fine on my local computer, but it does not work on upload to the server. I followed all the steps correctly. And I contacted support for my service, but 2 weeks passed and there was no answer.

I keep getting this error when I try to login or register a new user on my membership page on my site.

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) +1953274 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849707 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954 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) +175 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137 System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +378 System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +89 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) +815 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +78 System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119 System.Web.UI.WebControls.Login.AttemptLogin() +115 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) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166 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) +1565 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016 

Can someone please tell me why this error occurred (it is obvious that she cannot find something ...), and how can I fix it?

Thanks everyone

Bael

+75
sql sql-server stored-procedures
Jan 29 '10 at 23:18
source share
7 answers

Did you run aspnet_regsql.exe on the WinHost.com sql server?

 aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName 

You will need to make sure that you run it so that tables and objects are created on the WinHost.com SQL server.

+147
Feb 05 '10 at 17:26
source share

Open the visual studio command line from the Visual Studio tool folder from the Start menu and type aspnet_regsql

and follow the instructions in the wizard to register the database for membership providers and the asp.net role.

+26
Sep 19 '12 at 16:40
source share

I have seen this before. The database used does not have the necessary database elements for membership functions, roles, and profiles. So you have a few options:

  • Copy through tables, stored procedures and views from the local SQL Server using SQL Management Studio or a similar application
  • Use the aspnet_regsql.exe tool to install the scripts again according to the instructions in this post (I don’t think you can use this tool for the remote database if it is locked. So you have to export the scripts and run them manually).
+10
Feb 05 '10 at 16:14
source share

I have the same problem: I copy / paste connectionString from SQL Object manager in Visual Studio and forget to enter Initial Catalog=YourDatabaseName .

+5
Dec 15 '14 at 12:02
source share

Check the schema on which the stored procedure belongs on your host - maybe it is not in the "dbo" schema.

eg. if it is within SomeOtherSchema, your call should be "SomeOtherSchema.aspnet_CheckSchemaVersion"

+3
Jan 29 '10 at 23:27
source share

I had the same error when I included <roleManager> , believing that I included the ASP.NET 2 identifier. They do not match! <roleManager> included an old version of identity management which uses a different table structure for ASP.NET Identity 2 (which does not require "inclusion", by the way, there).

If you intentionally use the old role manager and still get the error, you can search localdb by default instead of your database, in which case you can change <roleManager> to point to any connection string you want

  <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="OurSqlRoleProvider" > <providers> <add connectionStringName="DefaultConnection" applicationName="/" name="OurSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> </providers> </roleManager> 

If you are using ASP.NET Identity 2, here is an article on it:
http://johnatten.com/2014/04/20/asp-net-mvc-and-identity-2-0-understanding-the-basics/

+3
Sep 13 '16 at 7:37
source share

In short, you must recompile the aspnet provider dll using the sql username that you assigned from your hosting.

  • Download http://download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi
  • Replace all dbo links from your source code with your hosting database username
  • Compile (you need Visual Studio) and place ProviderToolkitSampleProviders.dll in the Bin folder
  • In your web.config, replace the "type" attribute of each line with "Microsoft.Samples., ProviderToolkitSampleProviders"
  • Replace in your local sql server all dbo links with your hosting database username
  • Export the sql script object creation and run them in the remote database
  • Copy records from local aspnet_SchemaVersions sql table to the remote database

Another option that is easier to try is replacing the dbo links in your local sql server database with your hosting database username, then downloading and attaching the mdf file.

Hope this helps

Thomas

+1
Feb 05 '10 at 15:30
source share



All Articles