我目前有一个Asp.net网站,为其所有提供商使用MySQL数据库。 即时通讯使用默认的asp.net Web表单模板作为测试床,登录工作,注册工作,但当我尝试管理我的新帐户时,我收到此错误
Table 'trotski.usersopenauthaccounts' doesn't exist
尝试调用此函数时
Dim accounts = OpenAuth.GetAccountsForUser(User.Identity.Name)
(整个错误日志:)
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
答案 0 :(得分:0)
Table 'trotski.usersopenauthaccounts' doesn't exist
数据库usersopenauthaccounts
中的表trotski
不存在,它是自解释的吗?检查它指向的数据库并确保该表存在。
答案 1 :(得分:0)
堆栈跟踪表明您使用的是Visual Studio 2012
以及entity framework
和asp.net membership provider
。我怀疑您使用的是SimpleMembership提供程序并使用了Visual Studio中的模板。
您可能在项目的某个位置有SimpleMemberShipInitializer类的实现。在此实现中,您可以找到:
WebSecurity.InitializeDatabaseConnection(
"DefaultConnection", "UserProfile",
"UserId", "UserName", autoCreateTables: true
);
(在我的最新项目中,此代码位于InitializeSimpleMembershipAttribute.cs file
)
注意最后一个名为autoCreateTables的参数。使用此参数,您应该能够让SimpleMemberShip Provider创建所需的表,如果它们确实缺失的话。