abp icon indicating copy to clipboard operation
abp copied to clipboard

BookStore-Angular-MongoDb run the .DMigratior

Open pascalfossouo opened this issue 6 years ago • 1 comments

I download the BookStore-Angular-MongoDb on 2020-10-15. I used visual studio code to run my project. connectionstring :

"ConnectionStrings": { "Default": "mongodb://localhost:27017/BookStore" },

  • I rigth click to the Acme.BookStore.DMigrator.csproj to run it but after that I have this error

[Running] dotnet run --project "f:\Smartrek\Test\BookStore-Angular-MongoDb\aspnet-core\src\Acme.BookStore.DbMigrator\Acme.BookStore.DbMigrator.csproj" [09:17:40 INF] Started database migrations... [09:17:40 INF] Migrating schema for host database... [09:17:40 INF] Executing host database seed... Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.Identity.IdentityDataSeedContributor -> Volo.Abp.Identity.IdentityDataSeeder -> Castle.Proxies.IdentityUserManagerProxy. ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], Volo.Abp.Identity.IdentityUserStore, Volo.Abp.Identity.IIdentityRoleRepository, Volo.Abp.Identity.IIdentityUserRepository, Microsoft.Extensions.Options.IOptions1[Microsoft.AspNetCore.Identity.IdentityOptions], Microsoft.AspNetCore.Identity.IPasswordHasher1[Volo.Abp.Identity.IdentityUser], System.Collections.Generic.IEnumerable1[Microsoft.AspNetCore.Identity.IUserValidator1[Volo.Abp.Identity.IdentityUser]], System.Collections.Generic.IEnumerable1[Microsoft.AspNetCore.Identity.IPasswordValidator1[Volo.Abp.Identity.IdentityUser]], Microsoft.AspNetCore.Identity.ILookupNormalizer, Microsoft.AspNetCore.Identity.IdentityErrorDescriber, System.IServiceProvider, Microsoft.Extensions.Logging.ILogger1[Volo.Abp.Identity.IdentityUserManager], Volo.Abp.Threading.ICancellationTokenProvider, Volo.Abp.Identity.IOrganizationUnitRepository, Volo.Abp.Settings.ISettingProvider)' on type 'IdentityUserManagerProxy'. ---> System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString') at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName) at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString, IDnsResolver dnsResolver) at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString) at MongoDB.Driver.MongoUrlBuilder.Parse(String url) at MongoDB.Driver.MongoUrlBuilder..ctor(String url) at MongoDB.Driver.MongoUrl..ctor(String url) at Volo.Abp.Uow.MongoDB.UnitOfWorkMongoDbContextProvider1.GetDbContext() at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.get_DbContext() at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.get_SessionHandle() at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.GetMongoQueryable() at Volo.Abp.SettingManagement.MongoDB.MongoSettingRepository.GetListAsync(String providerName, String providerKey) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.SettingManagement.SettingManagementStore.SetCacheItemsAsync(String providerName, String providerKey, String currentName, SettingCacheItem currentCacheItem) at Volo.Abp.SettingManagement.SettingManagementStore.GetCacheItemAsync(String name, String providerName, String providerKey) at Volo.Abp.SettingManagement.SettingManagementStore.GetOrNullAsync(String name, String providerName, String providerKey) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Settings.TenantSettingValueProvider.GetOrNullAsync(SettingDefinition setting) at Volo.Abp.Settings.SettingProvider.GetOrNullValueFromProvidersAsync(IEnumerable1 providers, SettingDefinition setting) at Volo.Abp.Settings.SettingProvider.GetOrNullAsync(String name) at Volo.Abp.Settings.SettingProviderExtensions.GetAsync[T](ISettingProvider settingProvider, String name, T defaultValue) at Volo.Abp.Identity.AbpIdentityOptionsFactory.OverrideOptionsAsync(IdentityOptions options) at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task) at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.b__0(Task t) at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task) at Nito.AsyncEx.AsyncContext.Run(Func1 action) at Volo.Abp.Threading.AsyncHelper.RunSync(Func1 action) at Volo.Abp.Identity.AbpIdentityOptionsFactory.OverrideOptions(IdentityOptions options) at Volo.Abp.Identity.AbpIdentityOptionsFactory.Create(String name) at Microsoft.Extensions.Options.OptionsManager1.<>c__DisplayClass5_0.<Get>b__0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at System.Lazy1.get_Value() at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd(String name, Func1 createOptions) at Microsoft.Extensions.Options.OptionsManager1.Get(String name) at Microsoft.Extensions.Options.OptionsManager1.get_Value() at Microsoft.AspNetCore.Identity.UserManager1..ctor(IUserStore1 store, IOptions1 optionsAccessor, IPasswordHasher1 passwordHasher, IEnumerable1 userValidators, IEnumerable1 passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger1 logger) at Volo.Abp.Identity.IdentityUserManager..ctor(IdentityUserStore store, IIdentityRoleRepository roleRepository, IIdentityUserRepository userRepository, IOptions1 optionsAccessor, IPasswordHasher1 passwordHasher, IEnumerable1 userValidators, IEnumerable1 passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger1 logger, ICancellationTokenProvider cancellationTokenProvider, IOrganizationUnitRepository organizationUnitRepository, ISettingProvider settingProvider) at Castle.Proxies.IdentityUserManagerProxy..ctor(IInterceptor[] , IdentityUserStore store, IIdentityRoleRepository roleRepository, IIdentityUserRepository userRepository, IOptions1 optionsAccessor, IPasswordHasher1 passwordHasher, IEnumerable1 userValidators, IEnumerable1 passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger1 logger, ICancellationTokenProvider cancellationTokenProvider, IOrganizationUnitRepository organizationUnitRepository, ISettingProvider settingProvider) at lambda_method(Closure , Object[] ) at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() --- End of inner exception stack trace --- at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable1 parameters) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType) at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Acme.BookStore.Data.BookStoreDbMigrationService.SeedDataAsync(Tenant tenant) in F:\Smartrek\Test\BookStore-Angular-MongoDb\aspnet-core\src\Acme.BookStore.Domain\Data\BookStoreDbMigrationService.cs:line 92 at Acme.BookStore.Data.BookStoreDbMigrationService.MigrateAsync() in F:\Smartrek\Test\BookStore-Angular-MongoDb\aspnet-core\src\Acme.BookStore.Domain\Data\BookStoreDbMigrationService.cs:line 41 at Acme.BookStore.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in F:\Smartrek\Test\BookStore-Angular-MongoDb\aspnet-core\src\Acme.BookStore.DbMigrator\DbMigratorHostedService.cs:line 30 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Acme.BookStore.DbMigrator.Program.Main(String[] args) in F:\Smartrek\Test\BookStore-Angular-MongoDb\aspnet-core\src\Acme.BookStore.DbMigrator\Program.cs:line 29 at Acme.BookStore.DbMigrator.Program.

(String[] args)

pascalfossouo avatar Oct 15 '20 13:10 pascalfossouo

Hi I found my problem and resolved it. there are the septs :

  • When opening your project on Visual Studio Code Create a launch.json file and set the .DBMigrator as startup project.
  • Press the Run button you will see the migration said "Migration successful complete"
  • You can delete the .vscode/launch.json and create another like you did on the first sept, but now select your .HttpApi.Host as a startup project. Run the application

Thanks

pascalfossouo avatar Oct 15 '20 14:10 pascalfossouo