Hi @ESTeam
I'm glad that the DB error is fixed. When I look at the Microsoft's answer, it seems like you must change the request header names. You can change the
Abp.TenantId
used in AspNet Zero as shown below;
- For client side, set
abp.multiTenancy.tenantIdCookieName
.- For server side, set
Configuration.MultiTenancy.TenantIdResolveKey
For Cookies generated by ASP.NET Core, you can check its documentation.
If you can share how did you change
AspNetCoreCulture
, we can investigate why it didn't work.
Hi,
I changed the Abp.TenantId header as indicated and it worked, but when I change the ".AspNetCore.Culture" header to "AspNetCoreCulture" I can no longer modify the language in my local environment. I just modified the method getRequetHeadersWithDefaultValues on the client side: ![Capture.JPG] Note: I had previously removed the dots from all cookie names.
best regards, Dirceu
Hi,
Cannot insert the value NULL into column 'Id', table 'UatCufHealthPlan.dbo.AbpUserTokens'; column does not allow nulls.
This last error seems unrelated to using "." in cookies and request headers. The Id field must be auto-increment so it must be set by the database provider. Are there any changes on the database as well ?
For the issue using "." in cookies and request headers, I remember this problem from using NGINX. NGINX allows this by a custom configuration. Are you using NGINX ?
I have an response from microsoft - is there anything we can change in the code? (Previously I modified the ".AspNetCore.Culture" header to "AspNetCoreCulture" but I had to revert because I was unable to modify the language in the local environment, in the Azure environment it never worked).
*AppGw V2 uses NGINX. As I previously mentioned we state in our docs that dots are not supported in the request header. A work around is to play with the re-write rule until you get the desired outcome or have the app in the backend support the header without the dots.
Also, periods in header names seem to be in contradiction with RFC7230 https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-faq#why-are-some-header-values-not-present-when-requests-are-forwarded-to-my-application
RFC: RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing (ietf.org)
Please let me know if you need any further assistance.*
Hi,
Regarding the cookies microsoft are checking if any exception can be made on AppGw accepted characters.
I have now verified that the database error occurs because when the tables were migrated, the primary keys were left without the identity.
Thanks, Dirceu
Hi,
We have an application created with ASP.NET Zero that always worked correctly in the various environments (DEV, UAT and PROD), however when we migrated the application to a new Azure server (with Gateway) some things stopped working - Microsoft told us that we could not use "." in the names of cookies and request headers (https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-faq#why-are-some-header-values-not-present-when-requests-are-forwarded-to-my-application) so we had to make these changes - do you know if the errors we are having could be related to this change?
Problems encountered so far:
DEV - We were unable to modify the application language
UAT - Error: loging in with a valid user (if the user and password are not valid we get the normal and expected error) - The DEV and UAT environments have the same code version and the Database is also the same (only the data changes) so I can't understand why the error only occurs in the UAT environment:
ERROR 2024-02-08 14:30:13,059 [64 ] Mvc.ExceptionHandling.AbpExceptionFilter - An error occurred while updating the entries. See the inner exception for details.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'Id', table 'UatCufHealthPlan.dbo.AbpUserTokens'; column does not allow nulls. INSERT fails.
The statement has been terminated.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__164_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
ClientConnectionId:693fae65-22e2-4af2-a45e-6b9893c4a2a9
Error Number:515,State:2,Class:16
ClientConnectionId before routing:d4e11474-fd84-45d8-b437-096e351f398c
Routing Destination:ffc20ecd812f.tr38522.westeurope1-a.worker.database.windows.net,11014
--- End of inner exception stack trace ---
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 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(IList1 entriesToSave, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken) at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext
3.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesInDbContextAsync(DbContext dbContext)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesAsync()
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUowAsync()
at Abp.Domain.Uow.UnitOfWorkBase.CompleteAsync()
at Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
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|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
best regards, Dirceu Candeias
@Simonlum Do you resolve? I have same issue
Please answer the following questions before submitting an issue.
What is your product version? v11.4.1
What is your product type (Angular or MVC)? Angular
What is product framework type (.net framework or .net core)? .NET Core
Hello,
I saw that the framework is already prepared to use Twilio's Sendgrid SMS, however in this method it isn't returning the SMS provider. Do I need to do any configuration?
Hi,
I was following the tutorial "How to enable HttpOnly cookies in ASP.NET Zero Angular" but in the last step if I delete these lines as instructed in the tutorial, I get an error in the code. Can you confirm what you're actually supposed to do here?
https://github.com/aspnetzero/documents/blob/4dd4d4b159f58693bea04ed54b90cf4599ee7528/blog-posts/en/angular-http-only-cookie.md
If i delete the green lines it gives an error in the token variable and the refreshTokenObservable
I have the same challenge as @KPCS. Were you able to resolve it?