Hello there, I am running version 17.8.5 of Visual Studio 2022. We are at 12.3.1 version of ASP.NET zero.
Recently Power Tools started throwing this error
In Visual Studio I had ticked option to automatically upgrade to latest version of Power Tools, and I believe this is causing this error.
It looks like that visual studio marketplace has only the latest version: https://marketplace.visualstudio.com/items?itemName=Volosoft.AspNetZeroPowerTools&ssr=false#overview
Would you be able to help me with this?
Thanks, Peja
Hi support team,
We are using build-with-ng.ps1
to build our angular application and I can see the power shell generates a Dockerfile for each environment based on parameter we are passing to it.
# aspnet-core/build/outputs/aws/Dockerfile
FROM nginx
COPY . /usr/share/nginx/html
COPY nginx.conf /etc/nginx/
our process currently is:
app-config.json
fileappconfig.staging.json: |
{
"remoteServiceBaseUrl": "{{ .Values.api_url }}",
"appBaseUrl": "{{ .Values.console_url }}",
"localeMappings": {
"angular": [
{
"from": "pt-BR",
"to": "pt"
},
{
"from": "zh-CN",
"to": "zh"
},
{
"from": "he-IL",
"to": "he"
},
{
"from": "es-MX",
"to": "es"
},
{
"from": "vi",
"to": "en"
}
],
"luxon": [
{
"from": "es-MX",
"to": "es"
},
{
"from": "zh-Hans",
"to": "zh-cn"
},
{
"from": "vi",
"to": "en-gb"
}
],
"recaptcha": [
{
"from": "zh-Hans",
"to": "zh-cn"
},
{
"from": "es-MX",
"to": "es"
}
]
},
"helpdeskUrl" : "/app/main/helpdesk-not-available",
"contactUsUrl" : "https://www.denvrdata.com/contact",
"privacyPolicyUrl" : "https://www.denvrdata.com/privacy",
"termsOfServiceUrl" : "https://www.denvrdata.com/terms-of-service",
"documentationUrl" : "https://support.denvrdata.com/portal/en/kb/denvr-cloud",
"helpdeskTicketsUrl": "/app/main/helpdesk-not-available",
"defaultClusterUrl": "https://msc1.cloud.denvrdata.com",
"whatIsNewUrl": "https://support.denvrdata.com/portal/en/kb/articles/whats-new",
"termsAndConditionsUrl": "https://www.denvrdata.com/terms-of-use-embedded",
"trialTermsAndConditionsUrl": "https://www.denvrdata.com/test-drive-terms-of-use-embedded"
}
also noticed there is an env variable difference between environments
- name: ASPNETCORE_ENVIRONMENT
value: "Staging"
- name: ASPNETCORE_URLS
value: "http://+:80"
Technically what I am trying to do is I want to build only one docker container image for each version we build and use that across all environemtns currently we have dev
and prod
I want to pass appconfig.json
and env variables
to reuse the same built image,
ng build --configuration dev,staging,prod
adds something else that we are not aware of?#kubernetes #EKS #githubactions #docekrfile #dockerbuild #dockerhub #configmap
great thanks,
Moe - [email protected] - 1(416)824-1670
Hi, we noticed that when we cal TokenAuthController.Authenticate() method called for the same user, by 2 different transactions running approximately a the same time, one will fail with:
The database operation was expected to affect 1 row(s), but actually affected 0 row(s)
My understanding is that code is using optimistic locking and the second transaction fails as user data has already been changed by the first.
It looks like exception is happening in AbpLoginManager.TryLoginFromExternalAuthenticationSourceAsync() (see full stack trace below).
Is there a way to change the code so that both transactions eventually succeed?
Abp.Domain.Uow.AbpDbConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
---> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesAsync()
at Abp.Authorization.AbpLogInManager`3.TryLoginFromExternalAuthenticationSourcesAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.AbpLogInManager`3.LoginAsyncInternal(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.AbpLogInManager`3.<>c__DisplayClass36_0.<<LoginAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Abp.Domain.Uow.UnitOfWorkManagerExtensions.WithUnitOfWorkAsync[TResult](IUnitOfWorkManager manager, Func`1 action, UnitOfWorkOptions options)
at Abp.Authorization.AbpLogInManager`3.LoginAsync(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at DenvrDashboard.Web.Controllers.TokenAuthController.GetLoginResultAsync(String usernameOrEmailAddress, String password, String tenancyName) in C:\Users\PejaRadojkovic\workspace\tmp\DenvrDashboard\aspnet-core\src\DenvrDashboard.Web.Core\Controllers\TokenAuthController.cs:line 798
at DenvrDashboard.Web.Controllers.TokenAuthController.Authenticate(AuthenticateModel model) in C:\Users\PejaRadojkovic\workspace\tmp\DenvrDashboard\aspnet-core\src\DenvrDashboard.Web.Core\Controllers\TokenAuthController.cs:line 147
at lambda_method1476(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>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Hi, we are upgrading to the release 12.2.1. I tried downloading Metronic theme for the release, but cannot find it on the download page. The latest one is for release 11.0.0 (8.0.26). Thanks. Peja
Hi,
We are at the point where we need OpenID Connect server enabled, and start integrating other apps within our ecosystem.
I see in some other posts I read that IdentityServer 4 will be removed and eventually replaced with OpenIddict, but that there is no definite timeline.
Would you be able to point us in some direction how to do it and integrate it with AspNetZero (links, blogs, any other information)?
Many thanks. We love your product.
Peja
What is your product version? 11.0.0
What is your product type (Angular or MVC)? Angular
What is product framework type (.net framework or .net core)? .net core
Hi,
Recently we tried enabling 2FA Authentication.
It worked well for Host login - I was able to use email as a second factor in authentication
When I tried using GoogleAuthenticator in tenant login, after successfully passing first phase, I was presented with:
and after clicking the Submit I got: Security code could not be sent! error:
This might have something to do with the fact that we are using login without tenant (we made some modifications with your help in the past to achieve it).
Thanks, Peja
Until now we had our ASPNet.Core + Angular app running on AWS behind AWS Load Balancer and it worked fine. Recently we made change when our DNS is hosted by Clouflare and we are proxying calls to AWS Load Balancer.
We can deploy and run applicatin, however when we try impersonate login, we are getting error 500 internal server error.
This is the call that is failing in the browser
and on the Host side we are seeing this in logs:
"INFO 2022-11-03 20:53:42,610 [orker] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/1.1 OPTIONS http://api.cloud.denvrdata.com/api/TokenAuth/ImpersonatedAuthenticate?impersonationToken=0ab05a6d-52b9-4495-b98f-30cd17f0147d&d=1667508822061 - - - 204 - - 0.3677ms",
"INFO 2022-11-03 20:53:42,690 [orker] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 POST http://api.cloud.denvrdata.com/api/TokenAuth/ImpersonatedAuthenticate?impersonationToken=0ab05a6d-52b9-4495-b98f-30cd17f0147d&d=1667508822061 application/json 0",
"INFO 2022-11-03 20:53:42,690 [orker] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.",
"INFO 2022-11-03 20:53:42,691 [orker] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'DenvrDashboard.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate (DenvrDashboard.Web.Core)'",
"INFO 2022-11-03 20:53:42,693 [orker] c.Infrastructure.ControllerActionInvoker - Route matched with {action = \"ImpersonatedAuthenticate\", controller = \"TokenAuth\", area = \"\"}. Executing controller action with signature System.Threading.Tasks.Task`1[DenvrDashboard.Web.Models.TokenAuth.ImpersonatedAuthenticateResultModel] ImpersonatedAuthenticate(System.String) on controller DenvrDashboard.Web.Controllers.TokenAuthController (DenvrDashboard.Web.Core).",
"INFO 2022-11-03 20:53:42,701 [orker] osoft.EntityFrameworkCore.Infrastructure - Entity Framework Core 6.0.1 initialized 'DenvrDashboardDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL:6.0.2+854d2438884c0bf3a4ba8ccde2c47f7ba1ea3a4c' with options: None",
"ERROR 2022-11-03 20:53:42,705 [orker] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 3",
"System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 3",
" at DenvrDashboard.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable`1 tenantId) in C:\\Users\\PejaRadojkovic\\workspace\\denvrdata\\DenvrDashboard\\aspnet-core\\src\\DenvrDashboard.Core\\Authorization\\Impersonation\\ImpersonationManager.cs:line 113",
" at DenvrDashboard.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\\Users\\PejaRadojkovic\\workspace\\denvrdata\\DenvrDashboard\\aspnet-core\\src\\DenvrDashboard.Core\\Authorization\\Impersonation\\ImpersonationManager.cs:line 42",
" at DenvrDashboard.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\\Users\\PejaRadojkovic\\workspace\\denvrdata\\DenvrDashboard\\aspnet-core\\src\\DenvrDashboard.Web.Core\\Controllers\\TokenAuthController.cs:line 388",
" at lambda_method2457(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>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)",
" at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)",
I tried solutions to similar question suggested here: https://github.com/aspnetzero/aspnet-zero-core/pull/4198 but that didn't work (btw. we are already on the patched version of code).
Please let us know if you have any suggestion what we can do to resolve the issue.
Thanks, Peja
Hi,
We removed tenant from the login screen and followed your instruction about from: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Core-Angular-Sign-In-Without-Specifying-Tenant
Recently we tried setting user flag 'should change password on next login'. After authentication user is correctly redirected to the screen to change password, however when they attempt to do it we see following error:
ERROR 2022-06-10 06:04:41,070 [3 ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no user with id: 7
Abp.AbpException: There is no user with id: 7
at Abp.Authorization.Users.AbpUserManager`2.GetUserByIdAsync(Int64 userId)
at DenvrDashboard.Authorization.Accounts.AccountAppService.ResetPassword(ResetPasswordInput input) in C:\Users\PejaRadojkovic\workspace\denvrdata\DenvrDashboard\aspnet-core\src\DenvrDashboard.Application\Authorization\Accounts\AccountAppService.cs:line 138
at lambda_method2024(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>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Can you please advice how to resolve the issue. Thanks, Peja
Hi,
We decided to remove tenant from the login screen and followed your instruction about from: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Core-Angular-Sign-In-Without-Specifying-Tenant
It mostly went well, our users have unique emails andlogging in with emails works file. We configured logging in via Ldap for some tenatns, and this works fine as well.
There was however one issue:
when I logged in as a host admin, I would be logged in correctly but I was not able to use "Tenants -> Login as this Tenant" functionality. I was getting "You are not logged in as a host user!"
I dig up a bit, and found the error in tenants.components.ts in showUserImpersonateLookUpModal(record: any) method.
I commented out the check that caused the error, and thigs seem ok now, but I wanted to check with you guys if this is right way:
showUserImpersonateLookUpModal(record: any): void {
// if (abp.multiTenancy.getTenantIdCookie()) {
// this.message.warn(this.l('YouAreNotLoggedInAsAHostUser')).then(() => {
// document.location.reload();
// });
// return;
// }
this.impersonateUserLookupModal.tenantId = record.id;
this.impersonateUserLookupModal.show();
}
Thanks, Predrag
1. Issue with Timestamp fields in PostgreSQL
Hi, I tried today migrating to latest version of the framework (11.0.1) end there are couple of issues
We are usign PostgreSQL as a DB. After switching to .NET core 6.0 I also upgraded Npgsql.EntityFrameworkCore.PostgreSQL to version 6. When I started aspnet-core part, I got error:
InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported
I was able to get around the issue by adding this into Configure() method of Startup.cs but I am not sure if this is correct way to do it.
// workaround for issue when switched to .NET 6.0: 'InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported'
// solution found here: https://stackoverflow.com/questions/69961449/net6-and-datetime-problem-cannot-write-datetime-with-kind-utc-to-postgresql-ty
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
2. Links that suppose to open in new tab do not work in Default Theme, but work in Theme 2
One of the Menu items we added is link to external web page that opens in new tab. To achieve this we set externalLink to true in AppMenuItem:
new AppMenuItem('Helpdesk - New Tab', 'Pages.Tenant.Helpdesk.InNewTab', 'flaticon-book', 'https://EXTERNAL_URL_HERE', [], [], true)
Nothing happens when this menu item is clicked. Nothing is recorded in Console as well.
However, if I pick 'Theme 2', external link is correctly opened in new link. Can you please take a look and advice if this is right way to achieve opening external URL in a new tab.
Another minor issue is that although I downloaded version 11.0.1, version strings in the app still say: 11.0.0
Thanks and Regards, Predrag