Wednesday, February 20, 2013

Resolving Server Error: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

The Problem
When you create an asp.net mvc application by Visual studio 2010, by default the application services in the web.config is configured to use SqlExpress or some default instance. Now when you replace the connection string and  try to use the actual connection that doesn't have the membership provider stored procs. One situation could be when you try to invoke them by applying   [Authorizeattribute in your controller module and navigate to the Registration page, you will get the below error:

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: 

Line 80:                 // Attempt to register the user
Line 81:                 MembershipCreateStatus createStatus;
Line 82:                 Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);
Line 83: 
Line 84:                 if (createStatus == MembershipCreateStatus.Success)
The Solution:
You could resolve it by running aspnet_regsql.exe and follow the wizard directions to configure the relevant Database for your MVC application.

You could also run the below commandline:

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

No comments:

Post a Comment