Base solution for your next web application
Open Closed

Migrator Tool: Execution Error #3308


User avatar
0
tteoh created

Dear Support,

With the minimal documentation provided online AspnetZero Migrator tool, I have managed to:

  1. Locate the App.config and updated correctly
  2. Locate the exe in "..\Tools\MyApp.Migrator\bin\Debug

However, when I run the tool directly in the Debug folder, I encountered the following error:

2017-06-01 09:41:17 | HOST database migration started...
2017-06-01 09:41:17 | An error occured during migration of host database:
2017-06-01 09:41:17 | Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate OUD.EntityFramework.OUDDbContext ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Keyword not supported: 'thinkpad-x250; database'.
   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<SetConnectionString>b__18(DbConnection t, DbConnectionPropertyInterceptionContext`1 c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(DbConnection connection, DbConnectionPropertyInterceptionContext`1 interceptionContext)
   at System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(String nameOrConnectionString)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
   at System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()
   at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
   at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
   at Abp.EntityFramework.AbpDbContext.RegisterToChanges() in D:\Github\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 141
   at Abp.Zero.EntityFramework.AbpZeroDbContext`3..ctor(String nameOrConnectionString) in D:\Github\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\AbpZeroDbContext.cs:line 66
   at OUD.EntityFramework.OUDDbContext..ctor(String nameOrConnectionString) in C:\Users\Admin\Source\Workspaces\OUD\OUD\OUD.EntityFramework\EntityFramework\OUDDbContext.cs:line 87
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
   --- End of inner exception stack trace ---
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
   at Castle.Windsor.WindsorContainer.Resolve[T](Object argumentsAsAnonymousType)
   at Abp.Dependency.IocManager.Resolve[T](Object argumentsAsAnonymousType) in D:\Github\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:line 184
   at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver, Object argumentsAsAnonymousType) in D:\Github\aspnetboilerplate\src\Abp\Dependency\IocResolverExtensions.cs:line 53
   at Abp.Zero.EntityFramework.AbpZeroDbMigrator`2.CreateOrMigrate(AbpTenantBase tenant) in D:\Github\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\AbpZeroDbMigrator.cs:line 61
   at Abp.Zero.EntityFramework.AbpZeroDbMigrator`2.CreateOrMigrateForHost() in D:\Github\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\AbpZeroDbMigrator.cs:line 32
   at OUD.Migrator.MultiTenantMigrateExecuter.Run(Boolean skipConnVerification) in C:\Users\Admin\Source\Workspaces\OUD\OUD\Tools\OUD.Migrator\MultiTenantMigrateExecuter.cs:line 60
2017-06-01 09:41:17 | Canceled migrations.

Further questions:

  1. Could you please provide more details on this amazing tool that is supposed to ease Staging and Production deployment?
  2. Am I right to assume that if I run Migrator on empty database for the first time, it behaves as intialisation
  3. After making changes to existing model, and rerun the newly compiled Migrator.exe, it will only perform "database update"?

Thanks. /Tommy


4 Answer(s)
  • User Avatar
    0
    tteoh created

    Dear Support,

    Please ignore the error. I managed to fix it. It's my bad for setting the App.config wrongly.

    But I would appreciate if you could provide the clarifications to the questions. I believe the motivation of Migrator is to further simplify the database migration/update process compared to Migrate.exe from EF.

    However, from new learners, it is quite to grasp the overall perspective how the this tool is being put into action from DEV to PRD.

    Especially when transiting from DEV that the migration/update is performed using PM>, to PRD on using Migrator.

    Thanks. /Tommy

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tteoh,

    We are planning to create a simple documentation for Migrator tool as well.

    Thanks.

  • User Avatar
    0
    tteoh created

    Hi,

    Meanwhile, appreciate if you could help to clarify the below:

    1. How to deploy Migrator from DEV to PRD?
    2. Am I right to assume that if I run Migrator on empty database for the first time, it behaves as intialisation
    3. After making changes to existing model, I need to perform "Add-migration" with PM and rebuilt the Migrator. When rerun, the Migrator will perform "database update" based on newly generated migration class?

    Thanks. /Tommy

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    1. How to deploy Migrator from DEV to PRD?

    Actually, you just need to copy it's content in the "bin/release" folder. If you are using .Net core version, you need to first publish it using visual studio just like a web app and then use published content.

    1. Am I right to assume that if I run Migrator on empty database for the first time, it behaves as intialisation

    Yes, you are right.

    1. After making changes to existing model, I need to perform "Add-migration" with PM and rebuilt the Migrator. When rerun, the Migrator will perform "database update" based on newly generated migration class?

    Exactly.

    Thanks.