Base solution for your next web application
Open Closed

SQL Exception from fresh Zero 6.7.0 solution #6625


User avatar
0
mightyit created

I have downloaded a fresh Zero v6.7.0 base solution and am following the steps outlined in the getting started guide.

Once I have downloaded the project, ran yarn and npm run create-bundles, I update all my connectionstrings and run the migrator tool successfully, as can be seen from the below screenshot.

However, as soon as I run the *.Web.Mvc project, the following SqlException occurs:

System.Data.SqlClient.SqlException
  HResult=0x80131904
  Message=Invalid column name 'SubscriptionPaymentType'.
  Source=Core .Net SqlClient Data Provider
  StackTrace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ResultEnumerable`1.GetEnumerator()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__17`2.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.&lt;&gt;c__DisplayClass15_1`1.<CompileQueryCore>b__0(QueryContext qc)
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
   at MyCompany.MySolution.Migrations.Seed.Tenants.DefaultTenantBuilder.CreateDefaultTenant() in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\Migrations\Seed\Tenants\DefaultTenantBuilder.cs:line 27
   at MyCompany.MySolution.Migrations.Seed.Tenants.DefaultTenantBuilder.Create() in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\Migrations\Seed\Tenants\DefaultTenantBuilder.cs:line 20
   at MyCompany.MySolution.Migrations.Seed.SeedHelper.SeedHostDb(MySolutionDbContext context) in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 29
   at MyCompany.MySolution.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction) in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 42
   at MyCompany.MySolution.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 18
   at MyCompany.MySolution.EntityFrameworkCore.MySolutionEntityFrameworkCoreModule.PostInitialize() in D:\Projects\MySolution\src\MyCompany.MySolution.EntityFrameworkCore\EntityFrameworkCore\MySolutionEntityFrameworkCoreModule.cs:line 61
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Abp.AbpBootstrapper.Initialize()

Please advise...


2 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, have you run database migration?

    SubscriptionPaymentType column was added by this migration https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.EntityFrameworkCore/Migrations/20190103081952_Recurring_Payment_Changes.cs

    See https://docs.aspnetzero.com/documents/zero/latest/Getting-Started-Angular#database-migrations

  • User Avatar
    0
    mightyit created

    The "Default" connection string was set as a user secret. Once I updated it the issue was resolved.