0
    
    
        
                    jeffbuot created
                    
                    
                    
                
                - ABP Framework version: v5.3.0
 - Project type: Abp Microservice Template
 - DB provider: MongoDB
 - Exception message and stack trace:
 
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, Boolean isInternalRepresentation, 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.UnitOfWorkMongoDbContextProvider`1.GetDbContextAsync(CancellationToken cancellationToken)
   at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository`2.GetMongoQueryableAsync[TOtherEntity](CancellationToken cancellationToken)
   at Volo.Abp.Identity.MongoDB.MongoIdentityClaimTypeRepository.AnyAsync(String name, Nullable`1 ignoredId, CancellationToken cancellationToken)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.IdentityServer.IdentityResources.IdentityResourceDataSeeder.AddClaimTypeIfNotExistsAsync(String claimType)
   at Volo.Abp.IdentityServer.IdentityResources.IdentityResourceDataSeeder.CreateStandardResourcesAsync()
   at ProjectName.IdentityService.DbMigrations.IdentityServerDataSeeder.SeedAsync() in /Users/jeffb/Projects/projectname/services/identity/src/ProjectName.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs:line 72
   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.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at ProjectName.IdentityService.DbMigrations.IdentityServiceDataSeeder.SeedAsync(Nullable`1 tenantId, String adminEmail, String adminPassword) in /Users/jeffb/Projects/projectname/services/identity/src/PorjectName.IdentityService.HttpApi.Host/DbMigrations/IdentityServiceDataSeeder.cs:line 64
- Steps to reproduce the issue:"
 
- Create new microservice project from abp suite
 - Change the database context of all microservices from efcore sqlserver to mongo db by following this steps from: https://docs.abp.io/en/commercial/latest/guides/microservice-mongodb
 - Run the ProjectName.IdentityService.HttpApi.Host
 
7 Answer(s)
- 
    0
hi
It seems that the connection string is not getting correctly.
You can debug the
connectionStringResolvertry to get the connection string.var connectionStringResolver = ServiceProvider.GetRequiredService<IConnectionStringResolver>(); - 
    0
 - 
    0
hi
Can you share the source code with me? liming.ma@volosoft.com
 - 
    0
hi
Can you share the source code with me? liming.ma@volosoft.com
I invited you to a private github repo.
 - 
    0
ok, I will check.
 - 
    0
hi
Add
MyMultiTenantConnectionStringResolverto yourCMVPoint.IdentityService.MongoDBproject, I will fix this in 5.3 patch version.using System; using System.Threading.Tasks; using Microsoft.Extensions.Options; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; namespace CMVPoint.IdentityService.MongoDb; [Dependency(ReplaceServices = true)] public class MyMultiTenantConnectionStringResolver : MultiTenantConnectionStringResolver { public MyMultiTenantConnectionStringResolver( IOptionsMonitor<AbpDbConnectionOptions> options, ICurrentTenant currentTenant, IServiceProvider serviceProvider) : base(options, currentTenant, serviceProvider) { } public override Task<string> ResolveAsync(string connectionStringName = null) { if (connectionStringName == "Volo.Abp.Identity.MongoDB.IdentityProMongoDbContext") { return base.ResolveAsync("AbpIdentity"); } return base.ResolveAsync(connectionStringName); } public override string Resolve(string connectionStringName = null) { if (connectionStringName == "Volo.Abp.Identity.MongoDB.IdentityProMongoDbContext") { return base.Resolve("AbpIdentity"); } return base.Resolve(connectionStringName); } } - 
    0
hi
Add
MyMultiTenantConnectionStringResolverto yourCMVPoint.IdentityService.MongoDBproject, I will fix this in 5.3 patch version.using System; using System.Threading.Tasks; using Microsoft.Extensions.Options; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; namespace CMVPoint.IdentityService.MongoDb; [Dependency(ReplaceServices = true)] public class MyMultiTenantConnectionStringResolver : MultiTenantConnectionStringResolver { public MyMultiTenantConnectionStringResolver( IOptionsMonitor<AbpDbConnectionOptions> options, ICurrentTenant currentTenant, IServiceProvider serviceProvider) : base(options, currentTenant, serviceProvider) { } public override Task<string> ResolveAsync(string connectionStringName = null) { if (connectionStringName == "Volo.Abp.Identity.MongoDB.IdentityProMongoDbContext") { return base.ResolveAsync("AbpIdentity"); } return base.ResolveAsync(connectionStringName); } public override string Resolve(string connectionStringName = null) { if (connectionStringName == "Volo.Abp.Identity.MongoDB.IdentityProMongoDbContext") { return base.Resolve("AbpIdentity"); } return base.Resolve(connectionStringName); } }Hi, thanks issue has been resolved.
 
