Base solution for your next web application

Activities of "karimgarza"

Hi,

When deploying the angular 4 application on one port and the .net core in another there is a call from the browser made to the endpoint /AbpUserConfiguration/GetAll with the OPTIONS method. This call fails from the angular application but it is successful for a GET request from a browser.

The angular app logs the following error: OPTIONS <a class="postlink" href="http://x.x.x.x:22741/AbpUserConfiguration/GetAll">http://x.x.x.x:22741/AbpUserConfiguration/GetAll</a> net::ERR_EMPTY_RESPONSE

The asp.net core app logs the following:

Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HL6E2JO8MMJV" started.
Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HL6E2JO8MMJR" stopped.
Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HL6E2JO8MMJU" disconnecting.
Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HL6E2JO8MMJU" sending FIN.
Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HL6E2JO8MMJU" sent FIN with status "0".

I think this is a Cors issue but I do not know how to solve it. I have tried the following two configurations but neither seems to work.

//Configure CORS for angular2 UI
            services.AddCors(options =>
            {
                options.AddPolicy(DefaultCorsPolicyName, builder =>
                {
                //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                builder
                    //.WithOrigins(_appConfiguration["App:CorsOrigins"].Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => o.RemovePostFix("/")).ToArray())
                    .AllowAnyOrigin() //TODO: Will be replaced by above when Microsoft releases microsoft.aspnetcore.cors 2.0 - https://github.com/aspnet/CORS/pull/94
                    .AllowAnyHeader()
                    .WithMethods(new string[] {"OPTIONS","GET","POST","PUT","DELETE", "HEAD" });
                });
            });
//Configure CORS for angular2 UI
            services.AddCors(options =>
            {
                options.AddPolicy(DefaultCorsPolicyName, builder =>
                {
                    //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                    builder
                        //.WithOrigins(_appConfiguration["App:CorsOrigins"].Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => o.RemovePostFix("/")).ToArray())
                        .AllowAnyOrigin() //TODO: Will be replaced by above when Microsoft releases microsoft.aspnetcore.cors 2.0 - https://github.com/aspnet/CORS/pull/94
                        .AllowAnyHeader()
                        .AllowAnyMethod();
                });
            });

Hi,

I was getting the following error:

ERROR in /srv/tcagent/BuildAgent/work/a1dd18c76a64b6f5/af-win/angular/src/app/shared/layout/notifications/notifications.component.ts (5,30): Cannot find module '@shared/helpers/JTableHelper'.

ERROR in /srv/tcagent/BuildAgent/work/a1dd18c76a64b6f5/af-win/angular/src/app/shared/layout/linked-accounts-modal.component.ts (5,30): Cannot find module '@shared/helpers/JTableHelper'.

ERROR in /srv/tcagent/BuildAgent/work/a1dd18c76a64b6f5/af-win/angular/src/app/shared/common/lookup/common-lookup-modal.component.ts (6,30): Cannot find module '@shared/helpers/JTableHelper'.

I had to rename the file angular\src\shared\helpers\jtableHelper.ts to JTableHelper.ts

Hi,

I am getting the following error when I log in for the first time to the application and the flag ShouldChangePasswordOnNextLogin is true

INFO  2017-07-10 22:11:10,564 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core) with arguments (Airforce.AFWIN.Web.Models.TokenAuth.AuthenticateModel) - ModelState is Valid
DEBUG 2017-07-10 22:11:14,171 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core), returned result Microsoft.AspNetCore.Mvc.ObjectResult.
ERROR 2017-07-10 22:11:14,215 [3    ] Mvc.ExceptionHandling.AbpExceptionFilter - Database operation 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.
Abp.Domain.Uow.AbpDbConcurrencyException: Database operation 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: Database operation 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 Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(Tuple`2 parameters)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   --- End of inner exception stack trace ---
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUow()
   at Abp.Domain.Uow.UnitOfWorkBase.Complete()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Abp.Domain.Uow.UnitOfWorkBase.OnCompleted()
   at Abp.Domain.Uow.UnitOfWorkBase.<CompleteAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.<OnActionExecutionAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
DEBUG 2017-07-10 22:11:14,230 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'.
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Could not find an output formatter based on content negotiation. Accepted types were (application/json; charset=UTF-8)
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response.
INFO  2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.

Do you guys have any ideas as to why I am getting this error ?

The error does not happen if the ShouldChangePasswordOnNextLogin is set to false.

Thank you in advance,

Hi,

I am using the asp.net core / angular2 template

Upon the first login, I am getting an error when the user is set to ShouldChangePasswordOnNextLogin=true

Here is the log

INFO  2017-07-10 22:11:10,564 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core) with arguments (Airforce.AFWIN.Web.Models.TokenAuth.AuthenticateModel) - ModelState is Valid
DEBUG 2017-07-10 22:11:14,171 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core), returned result Microsoft.AspNetCore.Mvc.ObjectResult.
ERROR 2017-07-10 22:11:14,215 [3    ] Mvc.ExceptionHandling.AbpExceptionFilter - Database operation 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.
Abp.Domain.Uow.AbpDbConcurrencyException: Database operation 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: Database operation 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 Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(Tuple`2 parameters)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   --- End of inner exception stack trace ---
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUow()
   at Abp.Domain.Uow.UnitOfWorkBase.Complete()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Abp.Domain.Uow.UnitOfWorkBase.OnCompleted()
   at Abp.Domain.Uow.UnitOfWorkBase.<CompleteAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.<OnActionExecutionAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
DEBUG 2017-07-10 22:11:14,230 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'.
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Could not find an output formatter based on content negotiation. Accepted types were (application/json; charset=UTF-8)
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response.
INFO  2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.

Do you guys have any ideas on why this would be happening ?

Thank you,

Hi,

The following section contains the wrong sample code

<a class="postlink" href="https://aspnetzero.com/Documents/Developing-Step-By-Step-Angular#adding-database-migration">https://aspnetzero.com/Documents/Develo ... -migration</a>

It is re-adding the migration for the Person entity instead of adding the migration for the Phone Entity.

Showing 1 to 5 of 5 entries