我刚刚从 ASP.NET MVC 4 Internet 应用程序模板中部署了我的第一个 Azure 网站。该应用程序在我的本地计算机上运行良好。我按照这里找到的教程来部署网站:
http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/
部署站点后,我可以进入网站主页,我的家庭控制器不需要身份验证。当我尝试登录时,我被定向到错误页面。
我修改了我的 web.config 文件以获取自定义错误消息,并收到以下信息:
数据库中已经有一个名为“UserProfile”的对象。
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Data.SqlClient.SqlException:数据库中已经有一个名为“UserProfile”的对象。
源错误:
在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
堆栈跟踪:
[SqlException (0x80131904): 数据库中已经有一个名为 'UserProfile' 的对象。] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) +1753346 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) +5295154 System.Data.SqlClient.TdsParser。 ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean & dataReady) +1682 System.Data.SqlClient.SqlCommand .RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout) +280 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +405 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160 System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement) +125 System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable
1 migrationStatements) +113 System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable1 operations, Boolean downgrading, Boolean auto) +672 System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration) +267 System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable
1 pendingMigrations, String targetMigrationId, String lastMigrationId) +133 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +455 System.Data.Entity.MigrateDatabaseToLatestVersion2.InitializeDatabase(TContext context) +62 System.Data.Entity.<>c__DisplayClass2
1.b_ 0(DbContext c) +70 System.Data.Entity.Internal.<>c _DisplayClass8.b_ 6() +19 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(动作动作)+60 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +181 System.Data.Entity.Internal.LazyInternalContext.b _4(InternalContext c) +7 System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input) +110 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action
1 个动作)+185 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28 System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +52 System.Data.Entity.Internal.Linq.InternalSet
1. get_InternalContext() +15 System.Data.Entity.Internal.Linq.InternalSet1.Find(Object[] keyValues) +23 EnergyToolbase.Controllers.AccountController.Login(LoginModel model, String returnUrl) +94 lambda_method(Closure , ControllerBase , Object[] ) +147 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 个参数) +182 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28 System.Web.Mvc.Async.<>c__DisplayClass8
1.b__7(IAsyncResult ) +10 System.Web. Mvc.Async.WrappedAsyncResult1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58 System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +225 System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +225 System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c _DisplayClass2a.b_20() +24 System.Web.Mvc.Async.<>c _DisplayClass25.b_ 22(IAsyncResult asyncResult) +99 System.Web.Mvc.Async.WrappedAsyncResult1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +55 System.Web.Mvc.Controller。 EndExecuteCore(IAsyncResult asyncResult) +39 System.Web.Mvc.Async.<>c _DisplayClass4.b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult1.End() +55 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +55 System.Web.Mvc.MvcHandler .EndProcessRequest(IAsyncResult asyncResult) +31 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult 结果) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+9629708 系统。 Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
有人可以指点帮助我在这里找到问题。