Base solution for your next web application
Open Closed

ASP.NET Boilerplate Template cannot be installed properly #1963


User avatar
0
papageor created

Hi, I have already created a template ASP.NET Boilerplate project including Module Zero and I am trying to run the application but I am experiencing several problems: The first time I try to run the Update-Database command, I get the following exceptions:

PM> Update-Database Specify the '-Verbose' flag to view the SQL statements being applied to the target database. Applying explicit migrations: [201506210746108_AbpZero_Initial, 201509081207232_UpdateModuleZeroTo_0_6_9, 201509290947427_Upgrade_To_ModuleZero_0_7_1, 201510141938232_Upgrade_Abp_And_Module_Zero_To_0_7_3, 201511091457384_Upgrade_To_ModuleZero_0_7_4, 201512241146128_Upgrade_To_Module_Zero_0_7_6, 201512241148372_Created_Indexes, 201601032115057_Upgraded_Module_Zero_0_7_7, 201602161446590_Upgrade_Abp_And_Module_Zero_To_0_8_1, 201603021000202_Upgrade_Abp_And_Module_Zero_To_0_8_2, 201603220639423_Upgraded_To_Module_Zero_0_8_3, 201604271412090_Upgraded_To_V0_9, 201604281237494_Added_ConnectionString_To_Tenant, 201605021116147_Created_Table_AbpUserAccounts, 201605041151380_UserAccount_And_Notification_Changes, 201609110853544_Upgrade_To_ModuleZero_v1_12, 201609281412460_Upgrade_To_Abp_1_0]. Applying explicit migration: 201506210746108_AbpZero_Initial. Applying explicit migration: 201509081207232_UpdateModuleZeroTo_0_6_9. Applying explicit migration: 201509290947427_Upgrade_To_ModuleZero_0_7_1. Applying explicit migration: 201510141938232_Upgrade_Abp_And_Module_Zero_To_0_7_3. Applying explicit migration: 201511091457384_Upgrade_To_ModuleZero_0_7_4. Applying explicit migration: 201512241146128_Upgrade_To_Module_Zero_0_7_6. Applying explicit migration: 201512241148372_Created_Indexes. Applying explicit migration: 201601032115057_Upgraded_Module_Zero_0_7_7. Applying explicit migration: 201602161446590_Upgrade_Abp_And_Module_Zero_To_0_8_1. Warning! The maximum key length is 900 bytes. The index 'IX_NotificationName_EntityTypeName_EntityId_UserId' has maximum length of 1032 bytes. For some combination of large values, the insert/update operation will fail. Applying explicit migration: 201603021000202_Upgrade_Abp_And_Module_Zero_To_0_8_2. Applying explicit migration: 201603220639423_Upgraded_To_Module_Zero_0_8_3. Applying explicit migration: 201604271412090_Upgraded_To_V0_9. System.InvalidOperationException: The current migration SQL generator (SqlServerMigrationSqlGenerator) is unable to generate SQL for operations of type 'System.Data.Entity.Migrations.Model.AlterTableOperation'. Call SetSqlGenerator on your migrations configuration class to use a different SQL generator. To create a custom SQL generator that can handle this type of operation, add a new class that derives from SqlServerMigrationSqlGenerator and override Generate(MigrationOperation). at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(MigrationOperation migrationOperation) at CallSite.Target(Closure , CallSite , SqlServerMigrationSqlGenerator , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at CallSite.Target(Closure , CallSite , SqlServerMigrationSqlGenerator , Object ) at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.<GenerateStatements>b__2(Object o) at System.Data.Entity.SqlServer.Utilities.IEnumerableExtensions.Each[T](IEnumerable1 ts, Action1 action) at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateStatements(IEnumerable1 migrationOperations) at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(IEnumerable1 migrationOperations, String providerManifestToken) at System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList1 operations, String migrationId) at System.Data.Entity.Migrations.Infrastructure.MigratorBase.GenerateStatements(IList1 operations, String migrationId) at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable1 operations, IEnumerable1 systemOperations, Boolean downgrading, Boolean auto) at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration) at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration) at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable1 pendingMigrations, String targetMigrationId, String lastMigrationId) at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable1 pendingMigrations, String targetMigrationId, String lastMigrationId) at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration) at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b() at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration) at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run() at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) The current migration SQL generator (SqlServerMigrationSqlGenerator) is unable to generate SQL for operations of type 'System.Data.Entity.Migrations.Model.AlterTableOperation'. Call SetSqlGenerator on your migrations configuration class to use a different SQL generator. To create a custom SQL generator that can handle this type of operation, add a new class that derives from SqlServerMigrationSqlGenerator and override Generate(MigrationOperation).

I delete the Migrations and re-execute the process with a new migration. In this case, I get the following errors: Column 'NotificationName' in table 'dbo.NotificationSubscriptionInfoes' is of a type that is invalid for use as a key column in an index. Column 'TenancyName' in table 'dbo.UserLoginAttempts' is of a type that is invalid for use as a key column in an index.

Now, If I put the two related lines of the Migration class in comments(!!), the process is completed successfully and the database is created. But, when I try to run now the application I get the following runtime error:


[MissingMethodException: Method not found: 'System.Threading.Tasks.Task1<System.Collections.Generic.List1<!!0>> System.Data.Entity.QueryableExtensions.ToListAsync(System.Linq.IQueryable1<!!0>)'.] Abp.EntityFramework.Repositories.<GetAllListAsync>d__8.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:69 System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start(TStateMachine& stateMachine) +94 Abp.EntityFramework.Repositories.EfRepositoryBase3.GetAllListAsync() +145 Castle.Proxies.EfRepositoryBase2Proxy.GetAllListAsync_callback() +5

I am using VS2015 Professional Update3 + MS SQL Server 2012 and I have re-installed the latest version of the Entity Framework for the solution. Is something else that I should do or install?

Thanks


2 Answer(s)
  • User Avatar
    0
    papageor created

    This error was due to the fact that Entity Framework 6.0 was installed in the GAC. Once it was uninstalled, everything worked properly.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thank you for sharing your solution :)