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,

This happens when multi-tenancy is disabled and using the following ef providers

Devart.Data.MySql.EFCore 8.9.931 Devart.Data.MySql.EFCore.Design 8.9.931

But it does not happen with the Pomelo MySQL EF providers

There must be something that the Devart EFCore components do not implement and the Pomelo ones do.

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

It finally works !

I don't think I know what the problem is other than the application keep trying to re-insert languages upon every re-start, but removing the references to the devart dependencies and changing them for the mysql pomelo ones, removing all of the migrations, creating a new migration, updating the database and running the application works.

I used the following mysql packages for EF Core

<a class="postlink" href="https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/2.0.0-preview2-10046">https://www.nuget.org/packages/Pomelo.E ... iew2-10046</a> <a class="postlink" href="https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql.Design/">https://www.nuget.org/packages/Pomelo.E ... ql.Design/</a>

One thing that I noticed is that every time i re-launch the asp.net core application, the table abplanguages ends up with 10 more records. Right now I launched the application 5 times and I have 50 records.

Hi,

Thank you for your reply.

I created a new project today from your site, changed the application to single tenant, then removed the nuget package for sql server and added the the mysql nuget packagesmentioned in this post, changed the connection string, removed all the migrations, added a new migration updated the database using Update-Database.

I launched the asp.net core project and it ran (showed the swagger api), then i launched the angular project and I got the following error in the asp.net log when i opened the browser to <a class="postlink" href="http://localhost:4200">http://localhost:4200</a>

It seems that the angular project was trying to call the following endpoint <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> and got back an internal server error

Abp.AbpException: No language defined!
   at Abp.Localization.MultiTenantLocalizationDictionaryProvider.GetDefaultDictionary()
   at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetAllStrings(CultureInfo culture, Boolean includeDefaults)
   at Abp.Web.Configuration.AbpUserConfigurationBuilder.GetUserLocalizationConfig()
   at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetAll>d__13.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.Controllers.AbpUserConfigurationController.<GetAll>d__2.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.ObjectMethodExecutor.<CastToObject>d__38`1.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.&lt;InvokeActionMethodAsync&gt;d__27.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.&lt;InvokeNextActionFilterAsync&gt;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.&lt;InvokeNextExceptionFilterAsync&gt;d__24.MoveNext()

I'm using MySQL with this provider

Devart.Data.MySql.EFCore 8.9.931

Devart.Data.MySql.EFCore.Design 8.9.931

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 10 of 10 entries