Dear guys,
I have been encrypted the connection string based on IStringEncryptionService (from external application) and updated to appsettings.json looks like this:
"ConnectionStrings": { // "Default": "Server=192.168.0.1;Database=AbpTemplate;User=sa; Password=123xxx;TrustServerCertificate=true" "Default": "ENC_5W8PezYlu1g+VaIc/XzdKRGabzhpT8aAbk7R2Irkt8AhOpODisXIK4SMQEmd4EuT91Y....." },
Then, I decrypted:
AbpTemplateDbContext.cs `public class AbpTemplateDbContextFactory : IDesignTimeDbContextFactory
AbpTemplateEfCoreEntityExtensionMappings.Configure();
// This line to decrypted the connection string in appsettings.json
var connectionString = configuration.GetConnectionString("Default").DecryptConnectionString();
var builder = new DbContextOptionsBuilder<AbpTemplateDbContext>()
.UseSqlServer(connectionString);
return new AbpTemplateDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../AbpTemplate.DbMigrator/"))
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}`
I got this error while running app:
An unhandled exception occurred while processing the request. ArgumentException: Format of the initialization string does not conform to specification starting at index 0. System.Data.Common.DbConnectionOptions.GetKeyValuePair(string connectionString, int currentPosition, StringBuilder buffer, bool useOdbcRules, out string keyname, out string keyvalue).
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary2 parsetable, String connectionString, Boolean buildChain, Dictionary2 synonyms, Boolean firstKey)
at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary2 synonyms, Boolean useOdbcRules) at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value) at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled() at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async) at Volo.Abp.EntityFrameworkCore.GlobalFilters.AbpCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken) at Volo.Abp.EntityFrameworkCore.AbpEntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1.GetAsyncEnumerator(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable1.GetAsyncEnumerator() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken)
at Volo.Abp.LanguageManagement.EntityFrameworkCore.EfCoreLanguageRepository.GetListByIsEnabledAsync(Boolean isEnabled, CancellationToken cancellationToken)
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.LanguageManagement.DatabaseLanguageProvider.sCL3k4CHf() at Volo.Abp.Caching.DistributedCache2.GetOrAddAsync(TCacheKey key, Func1 factory, Func1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
at Volo.Abp.LanguageManagement.DatabaseLanguageProvider.GetLanguagesAsync()
at Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<
I found this code but it only allows pass connection key, how can I add the connection string encrypted value? [ReplaceDbContext(typeof(IIdentityProDbContext))] [ReplaceDbContext(typeof(ISaasDbContext))] [ConnectionStringName("Default")] public class AbpTemplateDbContext : AbpDbContext
Thank you.
Hi guys, I did not work with Abp.io for long-time and now I need to re-active my project. After update ABP Studio & Abp Suite, I got license error while running Abp Suite, website is working well. You should take a look the details in picture below and help me how to resolve.
Thanks.
Provide ABP info: