Base solution for your next web application
Open Closed

Error when new registered users click email #2372


User avatar
0
rvanwoezik created

I'm using ASP.NET MVC 5.x & Angularjs 1.x

Existing Users don't have problems, only for new users Checked DB Table AbpUsers, new user with mentioned id is in DB

I've extended User with properties like DateOfBirth, Address etc. Also changed to https / ssl

Workflow is that Admin adds User -> New User receives Email confirmation mail. When they click the link they get following error:

[https://www.phoogle.nl/Account/EmailConfirmation?userId=wRf37Cr1IEOkUyMX12s7Gg%3D%3D&tenantId=mFlm%2BKHDrbFA%2BQWcyocM9g%3D%3D&confirmationCode=fd8baadba672497695e88d687396a269])

There is no such an entity. Entity type: PhoogleZero.Authorization.Users.User, id: 199

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: PhoogleZero.Authorization.Users.User, id: 199

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[EntityNotFoundException: There is no such an entity. Entity type: PhoogleZero.Authorization.Users.User, id: 199]
   Abp.Domain.Repositories.<GetAsync>d__17.MoveNext() +325
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() +550
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Abp.Authorization.Users.&lt;GetUserNameFromDatabaseAsync&gt;d__64.MoveNext() +446
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Abp.Authorization.Users.&lt;UpdateAsync&gt;d__41.MoveNext() +517
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   PhoogleZero.Web.Controllers.&lt;EmailConfirmation&gt;d__39.MoveNext() +772
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Abp.Threading.&lt;AwaitTaskWithPostActionAndFinallyAndGetResult&gt;d__5`1.MoveNext() +550
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +97
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +17
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   Castle.Proxies.AccountControllerProxy.EndExecuteCore_callback(IAsyncResult asyncResult) +4
   Castle.Proxies.Invocations.Controller_EndExecuteCore.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +80
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) +42
   Castle.DynamicProxy.AbstractInvocation.Proceed() +108
   Castle.Proxies.AccountControllerProxy.EndExecuteCore(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   Castle.Proxies.AccountControllerProxy.EndExecute_callback(IAsyncResult asyncResult) +26
   Castle.Proxies.Invocations.Controller_EndExecute.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +80
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) +42
   Castle.DynamicProxy.AbstractInvocation.Proceed() +108
   Castle.Proxies.AccountControllerProxy.EndExecute(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129

Any Tips what can cause this?


30 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Which version of ABP do you use ?

  • User Avatar
    0
    rvanwoezik created

    1.3.1

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks for informing us, we will try this soon and get back to you.

  • User Avatar
    0
    rvanwoezik created

    Any news on this?

  • User Avatar
    0
    rvanwoezik created

    Am I the only one having this problem? Any tips? Should i upgrade to Core with Angular2?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I have tried with ABP v1.3.1 and it seems like it is working for me. Problem might be related to data. Can you share data for user with Id = 199 ? You can filter private information like username and email.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    By the way, can you use sql profiler to catch executed sql command for finding user with id=199. This might help as well.

    Thanks.

  • User Avatar
    0
    alexzapros created

    Hi the same is not working for me (MVC JQ ZERO Latest) for reset pwd and email activation

    There is no such an entity. Entity type:
    

    It get fine user, but when update it - loss tenantId. this code:

    [UnitOfWork]
            public virtual async Task<ActionResult> EmailConfirmation(EmailConfirmationViewModel model)
            {
                var tenantId = model.TenantId.IsNullOrEmpty()
                    ? (int?) null
                    : SimpleStringCipher.Instance.Decrypt(model.TenantId).To<int>();
                var userId = Convert.ToInt64(SimpleStringCipher.Instance.Decrypt(model.UserId));
    
                _unitOfWorkManager.Current.SetTenantId(tenantId);
    
                var user = await _userManager.GetUserByIdAsync(userId);
                if (user == null || user.EmailConfirmationCode.IsNullOrEmpty() ||
                    user.EmailConfirmationCode != model.ConfirmationCode)
                {
                    throw new UserFriendlyException(L("InvalidEmailConfirmationCode"),
                        L("InvalidEmailConfirmationCode_Detail"));
                }
    
                user.IsEmailConfirmed = true;
                user.EmailConfirmationCode = null;
    
                await _userManager.UpdateAsync(user);
    
  • User Avatar
    0
    rvanwoezik created

    I've started with a fresh database and get the same error when trying to confirm email address:

    [https://phoogle.nl/Account/EmailConfirmation?userId=KJmo8cGh2KVIuEVlW%2BjZZg%3D%3D&tenantId=sLwljR%2FBdR7W64QgwVFk%2Bw%3D%3D&confirmationCode=b113f64c9b6a4c3d8ceea410ec432c4a])

  • User Avatar
    0
    rvanwoezik created

    mmm,without change its working now.

  • User Avatar
    0
    rvanwoezik created

    So like AlexZapros mentioned, thnx Alex, I think it is a bug in the _userManager.UpdateAsync(user). Please check!

  • User Avatar
    0
    alexzapros created

    Hi, any updates here how to fix it?

  • User Avatar
    0
    rvanwoezik created

    As I was about to register my 100+ coworkers and send them a link where they can change their password.

    I am kinda waiting for a fix, I see it is added to the 3.1 Milestone, but can you tell me a fix date? I have to inform my coworkers.

    Kind regards, Rene

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This is a high priority problem for us and we are working on this. Probably we will fix this tomorrow.

  • User Avatar
    0
    rvanwoezik created

    Thnx for Your reply and good luck!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is fixed with this issue <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/293">https://github.com/aspnetboilerplate/mo ... issues/293</a>. We will release ABP & ABP Zero v1.4 today. When you update to v1.4, this problem should be fixed.

  • User Avatar
    0
    rvanwoezik created

    Great! Thanx for the quick fix.!

    Zero Rules!

    I have made a Dutch localization file, If you like I can send it so you can add it for other users

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We will be very happy if you send it :)

    Thanks.

  • User Avatar
    0
    rvanwoezik created

    I'm getting a build error

    At AspNetZeroAbpSession.cs

    Error CS7036: There is no argument given that corresponds to the required formal parameter 'multiTenancy' of 'ClaimsAbpSession.ClaimsAbpSession(IPrincipalAccessor, IMultiTenancyConfig, ITenantResolver, IAmbientScopeProvider<SessionOverride>)' (29, 15)
    
  • User Avatar
    0
    alexzapros created

    Hi, is it fix my issue too?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @rvanwoezik,

    Please change constructor of AspNetZeroAbpSession like this.

    public AspNetZeroAbpSession(
        IPrincipalAccessor principalAccessor,
        IMultiTenancyConfig multiTenancy,
        ITenantResolver tenantResolver,
        IAmbientScopeProvider<SessionOverride> ambientScopeProvider)
        : base(principalAccessor, multiTenancy, tenantResolver, ambientScopeProvider)
    {
    
    }
    

    Hi @AlexZapros,

    Yes it should solve your problem as well.

  • User Avatar
    0
    exlnt created

    I am getting this exact same error too in my app, on the ASP.Net MVC5 JQuery template version.

    [https://drive.google.com/open?id=0B5HAoiVVXzY7ZFEybUlKcFdZMVE])

  • User Avatar
    0
    alexzapros created

    So, what fix I should to current Asp.Zero code?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You need to upgrade to all ABP nuget packages to v1.4. Which version do you use currently ?

  • User Avatar
    0
    rvanwoezik created

    It's working fine now. Have a good weekend!