Shared a link by email:
Thanks
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
Hi
When I access a form link that requires login to complete, I get an unauthorized exception.
I am logged into the application as admin when I access the link but its still unauthorized.
The GetQuestionAsync method in the FormAppService [AllowAnonymous] and throws an exception if login is required and the user is not authenticated.
Admin has all Forms permissions - I don't believe permission needs to be granted to complete the forms, just on the admin side.
I spun up a new solution with abp suite and still get the issue.
Thanks
Browser console:
ApplicationConfigurationScript:3 Uncaught ReferenceError: $ is not defined at ApplicationConfigurationScript:3:1 at ApplicationConfigurationScript:2947:3 (anonymous) @ ApplicationConfigurationScript:3 (anonymous) @ ApplicationConfigurationScript:2947 ServiceProxyScript:12 Uncaught ReferenceError: abp is not defined at ServiceProxyScript:12:5 at ServiceProxyScript:38:5 at ServiceProxyScript:62:3 (anonymous) @ ServiceProxyScript:12 (anonymous) @ ServiceProxyScript:38 (anonymous) @ ServiceProxyScript:62 abp.js?_v=638087250027990000:44 WARN: abp.js?_v=638087250027990000:44 Could not find localization source: Forms
Web Log [22:28:31 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": "Unauthorized", "message": "Unauthorized", "details": null, "data": null, "validationErrors": null }
[22:28:31 ERR] Unauthorized
Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase
1.RequestAsync(ClientProxyRequestContext requestContext)
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase
1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
at Volo.Forms.Forms.ClientProxies.FormClientProxy.GetQuestionsAsync(Guid id, GetQuestionListDto input)
at lambda_method1952(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
HTTP API Log
[22:19:57 INF] Route matched with {area = "form", controller = "Form", action = "GetQuestions", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[System.Collections.Generic.List
1[Volo.Forms.Questions.QuestionDto]] GetQuestionsAsync(System.Guid, Volo.Forms.Questions.GetQuestionListDto) on controller Volo.Forms.Forms.FormController (Volo.Forms.HttpApi).
[22:19:57 WRN] ---------- RemoteServiceErrorInfo ----------
{
"code": null,
"message": "An internal error occurred during your request!",
"details": null,
"data": {},
"validationErrors": null
}
[22:19:57 WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
at Volo.Forms.Forms.FormAppService.GetQuestionsAsync(Guid id, GetQuestionListDto input)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Features.FeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) 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.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at lambda_method2612(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
[22:19:57 WRN] Code:
2022-09-09 15:02:55.907 +00:00 [ERR] Invalid non-ASCII or control character in header: 0x00E9 System.InvalidOperationException: Invalid non-ASCII or control character in header: 0x00E9
Hi
We are also experiencing this issue: https://support.abp.io/QA/Questions/3563/File-Management-file-download-exception
Our solution was to encode the file name before adding the header:
var fileName = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(fileDescriptor.Name));
However, this will result in a difference in the name of the original uploaded file and the downloaded file name.
Do you have a workaround solution that you can share that addresses this, as per #3563?
Thanks
Closed with solution here: https://support.abp.io/QA/Questions/3579/Possible-to-connect-using-two-different-database-management-systems-in-single-solution
Thank you so much!
It was trivial in the end and seems obvious now I see the solution.
The migrations weren't an issue for me in my production solution but thank you for updating those too and the docker setup.
I have deleted the commercial github repo and created a new open source repo. https://github.com/jtasko/MultipleDbContextDemo
This is based on the community post you shared and that I have already reviewed.
I removed the MongoDb project and added a new MySql EF Core Project (MultipleDbContextDemo.MySql.EntityFrameworkCore). This project has DBContext for the MySql database.
I updated the solution to contain two entities; TestSqlServerEntity and TestMySqlEntity.
I added connection strings for the MySql Db Context.
I created migrations for each EFCore project and updated the databases. Each database has the appropriate tables.
I have the same issue with this solution and cannot connect to both the MySql and SQL Server databases. The order of the DependsOn results in the application using either the Sql Server or MySql connections. One or the other, but not both.
There could very well be something trivial that I have missed but I really, honestly, could use some help here.
Thanks
Hi
I have completed some additional testing in a simpler solution and have the same issues.
I have the same issues where either MySql drivers are used or Sql Server drivers are used depending on the order of the DependsOn references.
I have uploaded the code to github: ** removed **
It's a very simple example and it demonstrates the same issues I am having with my more complex application.
Appreciate your assistance with this!
Thanks
No, I still have the issue.
The key difference is that the example uses two different database providers (MongoDB and EFCore). Whereas I am trying to use the same database provider (EF Core) with two different database management systems (SQL Server & MySQL).
My core solution is SQL Server and everything works with that. I am trying to add a MySQL readonly repository to read in data.
To simplify things, I created a brand new EFCore project in the current solution:
The module is configured to use MySql:
using Acs.Cts.MySql.Candidates;
using Acs.Cts.MySql.EntityFrameworkCore.Candidates;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;
namespace Acs.Cts.MySql.EntityFrameworkCore;
[DependsOn(
typeof(AbpEntityFrameworkCoreMySQLModule))]
public class MySqlEntityFrameworkCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
MySqlEfCoreEntityExtensionMappings.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<MySqlDbContext>(options =>
{
/* Remove "includeAllEntities: true" to create
* default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true);
options.AddRepository<TestCandidate, EfCoreTestCandidateRepository>();
});
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also PortalDbContextFactory for EF Core tooling. */
** options.UseMySQL();**
});
}
}
The MySqlDbContext has a "MySql" Connection string:
using Acs.Cts.MySql.Candidates;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
namespace Acs.Cts.MySql.EntityFrameworkCore;
**[ConnectionStringName("MySql")]**
public class MySqlDbContext : AbpDbContext<MySqlDbContext>, IMySqlDbContext
{
/* Add DbSet properties for your Aggregate Roots / Entities here. */
public MySqlDbContext(DbContextOptions<MySqlDbContext> options)
: base(options)
{
}
public DbSet<TestCandidate> TestCandidates { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
/* Configure your own tables/entities inside here */
/* Include modules to your migration db context */
builder.ConfigureMySql();
}
}
The MySql connection string is defined in the HttpApi.Host project appsettings.json:
In this project, I have a view defined on the MySQL database:
using Acs.Cts.MySql.Candidates;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
namespace Acs.Cts.MySql.EntityFrameworkCore;
public static class MySqlDbContextModelCreatingExtensions
{
public static void ConfigureMySql(
this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
/* Configure all entities here. */
if (builder.IsHostDatabase())
{
builder.Entity<TestCandidate>(b =>
{
b.ToView("vwTestCandidates");
});
}
}
}
The view returns a single row:
The project references my core domain project, which contains the TestCandidate entity:
The module in the HttpApi.Host project has references the MySqlEntityFrameworkCoreModule before (its the first DependsOn) the original PortalEntityFrameworkCoreModule:
The application service exists to get the list of TestCandidates:
When I invoke the service from Swagger, I get an error that indicates that a SQL Server driver is being used to try and connect to the MySQL database:
Log File:
2022-08-31 08:48:18.473 -07:00 [INF] Executing endpoint 'Acs.Cts.MySql.Candidates.TestCandidatesAppService.GetListAsync (Acs.Cts.Portal.Application)'
2022-08-31 08:48:18.490 -07:00 [INF] Route matched with {action = "GetList", controller = "TestCandidates", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Acs.Cts.MySql.Candidates.TestCandidateDto]] GetListAsync(Acs.Cts.MySql.Candidates.GetTestCandidateInput) on controller Acs.Cts.MySql.Candidates.TestCandidatesAppService (Acs.Cts.Portal.Application).
2022-08-31 08:48:18.949 -07:00 [DBG] Added 0 entity changes to the current audit log
2022-08-31 08:48:21.520 -07:00 [ERR] ---------- RemoteServiceErrorInfo ----------
{
"code": null,
"message": "An internal error occurred during your request!",
"details": null,
"data": {},
"validationErrors": null
}
**2022-08-31 08:48:21.520 -07:00 [ERR] Keyword not supported: 'port'.
System.ArgumentException: Keyword not supported: 'port'.
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder.GetIndex(String keyword)
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder.set_Item(String keyword, Object value)
at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.**<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async)
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 Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.LongCountAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Acs.Cts.MySql.EntityFrameworkCore.Candidates.EfCoreTestCandidateRepository.GetCountAsync(Nullable`1 id, CancellationToken cancellationToken) in C:\Users\Jamie\Repo\CTSPortal\apps\acs-portal\aspnet-core\src\Acs.Cts.MySql.EntityFrameworkCore\MySql\Candidates\EfCoreTestCandidateRepository.cs:line 38
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 Acs.Cts.MySql.Candidates.TestCandidatesAppService.GetListAsync(GetTestCandidateInput input) in C:\Users\Jamie\Repo\CTSPortal\apps\acs-portal\aspnet-core\src\Acs.Cts.Portal.Application\MySql\TestCandidateAppService.cs:line 24
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
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 lambda_method2691(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
If I swap the order of the DependsOn in the HttpApiHost module, I get an error with my original EFCore, which should be connecting to SQL Server, trying to connect using MySQL:
Log file:
022-08-31 08:53:17.476 -07:00 [ERR] An exception was thrown while activating Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext, Volo.Abp.BackgroundJobs.EntityFrameworkCore, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null]].
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext, Volo.Abp.BackgroundJobs.EntityFrameworkCore, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null]].
---> System.ArgumentException: Option 'trusted_connection' not supported.
at MySqlConnector.MySqlConnectionStringOption.GetOptionForKey(String key) in /_/src/MySqlConnector/MySqlConnectionStringBuilder.cs:line 927
at MySqlConnector.MySqlConnectionStringBuilder.set_Item(String key, Object value) in /_/src/MySqlConnector/MySqlConnectionStringBuilder.cs:line 808
at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
at Microsoft.EntityFrameworkCore.ServerVersion.AutoDetect(String connectionString)
at Volo.Abp.EntityFrameworkCore.AbpDbContextConfigurationContextMySQLExtensions.UseMySQL(AbpDbContextConfigurationContext context, Action`1 mySQLOptionsAction)
Framework version: 5.1.4 Angular/MVC SQL Server / MySql Separate Identity Server
Hi
I am opening a new issue since my previous one has been sitting unanswered for the past couple of weeks and seems to have fallen into a black hole.
I have an application that references two different database providers (SQL Server and MySQL). There are two different connection strings and two domain and EFCore projects. Each project uses the appropriate DB Context.
Both projects are references by the HttpApi.Host project but it seems as though only a single database management system is being used and the one that is used is the last referenced DependsOn module with a type of EntityFrameworkCoreModule in the Host project.
When the SqlServer module is last, the application starts fine and I don't get any errors until I invoke the application service (from an Application project that references both Domain projects) that uses the MySql repository. The error indicates that a SQL server driver is used when connecting to the MySql database:
2022-08-18 09:10:48.677 -07:00 [ERR] Keyword not supported: 'port'. System.ArgumentException: Keyword not supported: 'port'. at Microsoft.Data.SqlClient.SqlConnectionStringBuilder.GetIndex(String keyword) Here's what I've done so far and the issue I am experiencing:
When I swap these around and the MySql module is last, the application doesn't start because it attempts to connect to the SqlServer repositories used by the framework using a MySql connection:
2022-08-18 09:13:24.639 -07:00 [ERR] An exception was thrown while activating Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions1[[Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext, Volo.Abp.BackgroundJobs.EntityFrameworkCore, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null]]. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions
1[[Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext, Volo.Abp.BackgroundJobs.EntityFrameworkCore, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null]].
---> System.ArgumentException: Option 'trusted_connection' not supported.
at MySqlConnector.MySqlConnectionStringOption.GetOptionForKey(String key) in /_/src/MySqlConnector/MySqlConnectionStringBuilder.cs:line 927
In my Host project, I have the connection strings defined:
In the MySql Domain, Domain.Shared and EntityFrameworkCore projects, I have removed everything except for the minimum package references:
I am not sure how I can resolve this issue.
Thanks
Can someone please help me with this?
It's been more than a week and there's been no further support for this issue.
It's an urgent one for me now.
Thanks!