0
votes

I currently have a Asp.net site using a MySQL database for all its providers. im using the default asp.net web form template as a test bed, login works, register works, but when i try and manage my new account, i get this error

Table 'trotski.usersopenauthaccounts' doesn't exist

when it tries to call this function

Dim accounts = OpenAuth.GetAccountsForUser(User.Identity.Name)

(the whole error log:)


    Table 'trotski.usersopenauthaccounts' doesn't exist

    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: MySql.Data.MySqlClient.MySqlException: Table 'trotski.usersopenauthaccounts' doesn't exist

    Source Error: 


    Line 68:     
    Line 69:     Public Function GetExternalLogins() As IEnumerable(Of OpenAuthAccountData)
    Line 70:         Dim accounts = OpenAuth.GetAccountsForUser(User.Identity.Name)
    Line 71:         CanRemoveExternalLogins = CanRemoveExternalLogins OrElse accounts.Count() > 1
    Line 72:         Return accounts

    Source File: C:\Users\dev1\Documents\Visual Studio 2012\Projects\MySite\MySite\Account\Manage.aspx.vb    Line: 70 

    Stack Trace: 


    [MySqlException (0x80004005): Table 'trotski.usersopenauthaccounts' doesn't exist]
       MySql.Data.MySqlClient.MySqlStream.ReadPacket() +383
       MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) +116
       MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) +54
       MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) +145
       MySql.Data.MySqlClient.MySqlDataReader.NextResult() +1258
       MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +2523
       MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +58
       System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
       System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +437

    [EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
       System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +507
       System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +730
       System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +131
       System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +36
       System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator() +126
       System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +99
       System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
       System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
       Microsoft.AspNet.Membership.OpenAuth.EFOpenAuthMembershipDatabase.GetAccountsForUser(String membershipUserName) +2838
       Microsoft.AspNet.Membership.OpenAuth.OpenAuthManager.GetAccountsForUser(String membershipUserName) +127
       Microsoft.AspNet.Membership.OpenAuth.OpenAuth.GetAccountsForUser(String membershipUserName) +59
       MySite.Manage.GetExternalLogins() in C:\Users\dev1\Documents\Visual Studio 2012\Projects\MySite\MySite\Account\Manage.aspx.vb:70

    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
       System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
       System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
       System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
       lambda_method(Closure , MethodInfo , Object , Object[] ) +46
       System.Web.UI.WebControls.ModelDataSourceView.InvokeMethod(ModelDataSourceMethod method) +207
       System.Web.UI.WebControls.ModelDataSourceView.GetSelectMethodResult(DataSourceSelectArguments arguments) +74
       System.Web.UI.WebControls.ModelDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +14
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
       System.Web.UI.WebControls.ListView.PerformSelect() +167
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
       System.Web.UI.WebControls.ListView.CreateChildControls() +122
       System.Web.UI.Control.EnsureChildControls() +83
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

2

2 Answers

0
votes
Table 'trotski.usersopenauthaccounts' doesn't exist

The table usersopenauthaccounts in the database trotski isn't there, it's self explanatory? Check the database it's pointing to and make sure the table exists.

0
votes

The stack trace suggests that you are using Visual Studio 2012 and the entity framework and the asp.net membership provider. I suspect that you are using the SimpleMembership provider and have used the templates from Visual Studio.

You probably have an implementation of the SimpleMemberShipInitializer class somewhere in your project. In this implementation you could find:

WebSecurity.InitializeDatabaseConnection(
"DefaultConnection", "UserProfile", 
"UserId", "UserName", autoCreateTables: true
);

(In my latest project this code is found in the filters folder inside the InitializeSimpleMembershipAttribute.cs file)

Notice the last parameter called autoCreateTables. With this parameter you should be able to get the SimpleMemberShip Provider to create the needed tables if they are really missing.