Okay we have two issues here: (I opened the log file in VS Code and searched for [Err]
[ERR] One or more errors occurred. (ps (Parameter 'Expected [lock] to be a field or gettable property on [<>f__AnonymousType0`2[[StackExchange.Redis.RedisKey, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46],[StackExchange.Redis.RedisValue, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46]]]'))
System.AggregateException: One or more errors occurred. (ps (Parameter 'Expected [lock] to be a field or gettable property on [<>f__AnonymousType0`2[[StackExchange.Redis.RedisKey, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46],[StackExchange.Redis.RedisValue, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46]]]'))
---> System.ArgumentException: ps (Parameter 'Expected [lock] to be a field or gettable property on [<>f__AnonymousType0`2[[StackExchange.Redis.RedisKey, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46],[StackExchange.Redis.RedisValue, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46]]]')
at StackExchange.Redis.LuaScript.ExtractParameters(Object ps, Nullable`1 keyPrefix, RedisKey[]& keys, RedisValue[]& args) in /_/src/StackExchange.Redis/LuaScript.cs:line 117
at StackExchange.Redis.LuaScript.EvaluateAsync(IDatabaseAsync db, Object ps, Nullable`1 withKeyPrefix, CommandFlags flags) in /_/src/StackExchange.Redis/LuaScript.cs:line 161
at StackExchange.Redis.RedisDatabase.ScriptEvaluateAsync(LuaScript script, Object parameters, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 1245
at Medallion.Threading.Redis.Primitives.RedisScript`1.ExecuteAsync(IDatabaseAsync database, TArgument argument, Boolean fireAndForget) in /_/DistributedLock.Redis/Primitives/RedisScript.cs:line 29
at Medallion.Threading.Redis.Primitives.RedisMutexPrimitive.ReleaseAsync(IDatabaseAsync database, Boolean fireAndForget) in /_/DistributedLock.Redis/Primitives/RedisMutexPrimitive.cs:line 36
at Medallion.Threading.Redis.RedLock.RedLockRelease.ReleaseAsync() in /_/DistributedLock.Redis/RedLock/RedLockRelease.cs:line 69
--- End of inner exception stack trace ---
at Medallion.Threading.Redis.RedLock.RedLockRelease.ReleaseAsync() in /_/DistributedLock.Redis/RedLock/RedLockRelease.cs:line 78
at Medallion.Threading.Redis.RedLock.RedLockHandle.DisposeAsync() in /_/DistributedLock.Redis/RedLock/RedLockHandle.cs:line 52
at Volo.Abp.BackgroundJobs.BackgroundJobWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
at Volo.Abp.BackgroundWorkers.AsyncPeriodicBackgroundWorkerBase.DoWorkAsync(CancellationToken cancellationToken)
Do you have any AsyncPeriodicBackgroundWorker
in place?
other issue (which I think is the one relevant for this issue:
2023-06-13 09:51:49.821 +03:00 [ERR] Exception occurred while processing message.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://localhost:44378/.well-known/openid-configuration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://localhost:44378/.well-known/openid-configuration'.
---> System.Net.Http.HttpRequestException: Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı. (localhost:44378)
---> System.Net.Sockets.SocketException (10061): Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.SendAsyncAndRetryOnNetworkError(HttpClient httpClient, Uri uri)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
2023-06-13 09:51:49.828 +03:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://localhost:44378/.well-known/openid-configuration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://localhost:44378/.well-known/openid-configuration'.
---> System.Net.Http.HttpRequestException: Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı. (localhost:44378)
---> System.Net.Sockets.SocketException (10061): Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.SendAsyncAndRetryOnNetworkError(HttpClient httpClient, Uri uri)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
I can see in the logs that you use openiddict. Can you check your configuration and/ or send me the auth server logs?
If those things also do not clarify what happens here, I would need to see the code to debug through it.
Kind regards Jack
Did you receive the email I sent?
yes :)
Is it okay if I send an email with the full content of the logs?
sure. please send it to kontakt@chrobyte.de
Hey,
as it turns out there is an issue at the moment with blazor server side and auditing:
https://support.abp.io/QA/Questions/5116/Blazor-Server-Audit-Log-Not-Working-For-Update#answer-3a0b5f0d-9ca6-6799-048e-e25ecde8605a
You can check the status here: https://github.com/abpframework/abp/issues/11682
I'll refund your Ticket. Sorry for the inconvenience.
Kind regards Jack
Seems good to me. Can you share logs of the api? your logs seem like they come from blazor
Hey,
If the packages are up to date, it may be that there's an issue with the menu contributor. Content of that would also be interesting if it's not package version related.
Kind regards Jack
Hey,
how did you configure your auditing?
https://docs.abp.io/en/abp/latest/Audit-Logging
Kind regards Jack
Hi that code is wrapped up in an entire email confirmation process for us so there is nothing I can really share. The snippet I provided above IS standalone though you should be able to just inject the abp TenantService anywhere as a quick test, then call Create with an additional connectionstrings.
Okay understood. I'll try my best and keep you updated
Hey Jasen,
sorry that you're experiencing troubles. Can you maybe share the complete file with me? I will then try to reproduce and debug it. If it's a bug, we'll of course refund the ticket.
kind regards Jack
Hey,
So here are my steps according to the documentation: I had to make some adjustments. If you exactly to the steps I describe here, you should be fine to go (as they worked out for me).
⚠️ Changed things
This is okay:
YourProjectNameEntityFrameworkCoreModule.cs inside the .EntityFrameworkCore project. Replace UseSqlServer() with UseMySQL().
This is something I made a bit different:
YourProjectNameDbContextFactory.cs inside the .EntityFrameworkCore project. Replace UseSqlServer() with UseMySql(). Then add a new parameter (ServerVersion) to UseMySql() method. Example: .UseMySql(configuration.GetConnectionString("Default"), ServerVersion.Parse("8.0.21-mysql")). See this issue for more information about ServerVersion)
My change looks like this:
public AdministrationServiceDbContext CreateDbContext(string[] args)
{
AdministrationServiceEfCoreEntityExtensionMappings.Configure();
var connectionString = GetConnectionStringFromConfiguration();
var builder = new DbContextOptionsBuilder<AdministrationServiceDbContext>()
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), b =>
{
b.MigrationsHistoryTable("__AdministrationService_Migrations");
});
return new AdministrationServiceDbContext(builder.Options);
}
*In addition to that, some of the ServiceDbContext.cs file needed more adjustment.
before:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.ConfigureWarnings(w => w.Ignore(SqlServerEventId.SavepointsDisabledBecauseOfMARS));
base.OnConfiguring(optionsBuilder);
}
after:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
}
pretty straight forward.
My new connection string look like this:
"ConnectionStrings": {
"ProductService": "server=127.0.0.1;port=3306;user=mysuperduperuser;pwd=mysuperduperpasswort;database=Doctorz_ProductService",
"IdentityService": "server=127.0.0.1;port=3306;user=mysuperduperuser;pwd=mysuperduperpasswort;database=Doctorz_Identity",
"AdministrationService": "server=127.0.0.1;port=3306;user=mysuperduperuser;pwd=mysuperduperpasswort;database=Doctorz_Administration",
"SaasService": "server=127.0.0.1;port=3306;user=mysuperduperuser;pwd=mysuperduperpasswort;database=Doctorz_Saas"
},
Did exactly what the docs told me
⚠️ Adjustments needed to be made
First: Deleted everything inside the migrations folders
Second: executed dotnet build /graphBuild
on solution level
Third:
Wanted to add initial migrations
PM> Add-Migration "Initial"
Build started...
Build succeeded.
The Entity Framework tools version '7.0.1' is older than that of the runtime '7.0.2'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.
[14:44:46 INF] Starting G1.Clinic.Doctorz.AdministrationService.HttpApi.Host.
[14:44:46 FTL] G1.Clinic.Doctorz.AdministrationService.HttpApi.Host terminated unexpectedly!
Microsoft.Extensions.Hosting.HostAbortedException: The host was aborted.
at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.ThrowHostAborted()
at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.OnNext(KeyValuePair`2 value)
at System.Diagnostics.DiagnosticListener.Write(String name, Object value)
at Microsoft.Extensions.Hosting.HostBuilder.ResolveHost(IServiceProvider serviceProvider, DiagnosticListener diagnosticListener)
at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at G1.Clinic.Doctorz.AdministrationService.Program.Main(String[] args) in C:\G1.Clinic.Doctorz\services\administration\src\G1.Clinic.Doctorz.AdministrationService.HttpApi.Host\Program.cs:line 28
To undo this action, use Remove-Migration.
Used this answer https://stackoverflow.com/a/76170042
my program.cs now looks like this:
public async static Task<int> Main(string[] args)
{
var assemblyName = typeof(Program).Assembly.GetName().Name;
SerilogConfigurationHelper.Configure(assemblyName!);
try
{
Log.Information($"Starting {assemblyName}.");
var builder = WebApplication.CreateBuilder(args);
builder.Host
.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<AdministrationServiceHttpApiHostModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex) when (ex is not HostAbortedException)
{
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly! \nEX: {ex}\nStackTrace: {ex.StackTrace}\nINNER{ex.InnerException}");
return 1;
}
finally
{
Log.CloseAndFlush();
}
After that, I was able to create the migrations.
I executed dotnet build /graphBuild
again just to ensure I did everything correctly (solution still buildable) and it went through.
Fourth: Run the DbMigrator
[16:01:56 INF] Loaded ABP modules:
...
[16:01:56 DBG] Started background worker: Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker
[16:01:56 INF] Initialized all ABP modules.
[16:01:56 INF] Migrating Host side...
[16:01:56 INF] Migrating SaasService database...
[16:01:57 INF] Migrating AdministrationService database...
[16:01:59 INF] Migrating IdentityService database...
[16:02:00 INF] Migrating ProductService database...
[16:02:01 INF] All databases have been successfully migrated (HOST).
[16:02:04 INF] Migrating tenants...
[16:02:04 INF] Migration completed!
[16:02:04 DBG] Stopped background worker: Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker
C:\G1.Clinic.Doctorz\shared\G1.Clinic.Doctorz.DbMigrator\bin\Debug\net7.0\G1.Clinic.Doctorz.DbMigrator.exe (process 43416) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
⚠️
adjust run-tye.yaml. You do not need sql-server-db. you may replace it with mysql server also adjust ms sql stuff from build/etc/docker to match your requirements
Now, execute run-tye.ps1
from the solution directory.