Base solution for your next web application
Open Closed

Warning " Current user did not login to the application!" #2023


User avatar
0
muiscatron created

Hi, I had a working sample application derived from ASP.Net boilerplate/modulezero version 0.83. I tried to upgrade it to version 1.0.0, but encountered some problems. One of these was I had a console app which populated a tenant and a user; now this app failed with the error above. So I tried to create a completely new sample from the version 1.0.0. This template is also showing this warning in its log after I log in as admin host (see log below). The only changes in my template are:

  • Enable Nuget automatic package restore ([https://docs.nuget.org/ndocs/consume-packages/package-restore#migrating-to-automatic-restore]))
  • Change connection string to use SQL Express default instance instead of localdb

Can anyone help to diagnose this? thanks

DEBUG 2016-11-27 15:40:40,860 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - MyCompany.MyProject.MultiTenancy.Dto.CreateTenantInput
DEBUG 2016-11-27 15:40:40,860 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - MyCompany.MyProject.MultiTenancy.Dto.TenantListDto
DEBUG 2016-11-27 15:40:42,441 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'MyCompany.MyProject.Sessions.ISessionAppService' with service name 'app/session'.
DEBUG 2016-11-27 15:40:42,441 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'MyCompany.MyProject.Users.IUserAppService' with service name 'app/user'.
DEBUG 2016-11-27 15:40:42,441 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'MyCompany.MyProject.Roles.IRoleAppService' with service name 'app/role'.
DEBUG 2016-11-27 15:40:42,441 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'MyCompany.MyProject.MultiTenancy.ITenantAppService' with service name 'app/tenant'.
WARN  2016-11-27 15:40:45,129 [6    ] Abp.Logging.LogHelper                    - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__19.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 42
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.AuthorizationHelper.<CheckPermissions>d__22.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 100
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__20.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass3.<Run>b__1(Task t)
   at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelperExtensions.cs:line 27
   at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeFilter.cs:line 42
Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.&lt;AuthorizeAsync&gt;d__19.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 42
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.AuthorizationHelper.&lt;CheckPermissions&gt;d__22.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 100
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.AuthorizationHelper.&lt;AuthorizeAsync&gt;d__20.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Nito.AsyncEx.AsyncContext.&lt;&gt;c__DisplayClass3.&lt;Run&gt;b__1(Task t)
   at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelperExtensions.cs:line 27
   at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeFilter.cs:line 42
DEBUG 2016-11-27 15:41:00,376 [7    ] Abp.Web.SignalR.Hubs.AbpCommonHub        - A client is connected: {"ConnectionId":"75793aa7-5883-4fc9-b632-56da80d22722","IpAddress":"::1","TenantId":null,"UserId":1,"ConnectTime":"2016-11-27T15:41:00.3688488+00:00","Properties":{}}

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

    Hi,

    Can you try to run your app with a different browser ? And see if the same error happens again.

  • User Avatar
    0
    muiscatron created

    Hello, Finally I got to try this again; I have done so on different browsers and even a different computer; with the same result.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you applied migrations after changing connection string ? And, what happens when you change connection string back to old version, local db ? Does your project work ?

  • User Avatar
    0
    muiscatron created

    Hi, Thanks for the reply. I have just created a completely new template and left everything as default (connection string is : Server=localdb; Database=MyProject; Trusted_Connection=True;)

    I posted mistakenly in my original post - I thought I remembered that the default connection string was using localdb.

    I ran update-database to create the database, then started the application and signed in as admin (host). Again, I get the same warning in the log.

    WARN  2017-01-04 09:25:00,953 [6    ] Abp.Logging.LogHelper                    - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
       at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__19.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 42
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Authorization.AuthorizationHelper.<CheckPermissions>d__22.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 100
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__20.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 67
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Nito.AsyncEx.AsyncContext.<>c__DisplayClass3.<Run>b__1(Task t)
       at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
       at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo) in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelperExtensions.cs:line 27
       at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeFilter.cs:line 48
    Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
       at Abp.Authorization.AuthorizationHelper.&lt;AuthorizeAsync&gt;d__19.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 42
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Authorization.AuthorizationHelper.&lt;CheckPermissions&gt;d__22.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 100
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Authorization.AuthorizationHelper.&lt;AuthorizeAsync&gt;d__20.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 67
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Nito.AsyncEx.AsyncContext.&lt;&gt;c__DisplayClass3.&lt;Run&gt;b__1(Task t)
       at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
       at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo) in D:\Halil\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelperExtensions.cs:line 27
       at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeFilter.cs:line 48
    DEBUG 2017-01-04 09:25:09,793 [6    ] Abp.Web.SignalR.Hubs.AbpCommonHub        - A client is connected: {"ConnectionId":"da269317-fac8-4c76-8922-fb1a15c83648","IpAddress":"::1","TenantId":null,"UserId":null,"ConnectTime":"2017-01-04T09:25:09.7805294+00:00","Properties":{}}
    DEBUG 2017-01-04 09:25:09,836 [9    ] Abp.Web.SignalR.Hubs.AbpCommonHub        - A client is registered: da269317-fac8-4c76-8922-fb1a15c83648
    DEBUG 2017-01-04 09:25:34,317 [13   ] Abp.Web.SignalR.Hubs.AbpCommonHub        - A client is connected: {"ConnectionId":"52175503-c669-4bbf-9178-0662c78ef3c8","IpAddress":"::1","TenantId":null,"UserId":1,"ConnectTime":"2017-01-04T09:25:34.3168545+00:00","Properties":{}}
    DEBUG 2017-01-04 09:25:34,338 [11   ] Abp.Web.SignalR.Hubs.AbpCommonHub        - A client is registered: 52175503-c669-4bbf-9178-0662c78ef3c8
    
  • User Avatar
    0
    muiscatron created

    Further clarification:

    In fact the warning in the log occurs when the application starts up - not on signing in.

  • User Avatar
    0
    muiscatron created

    Further update - Previous templates that I used were ASP.NET MVC 5; I just tried an ASP.NET Core template and I get exactly the same warning.

    Next attempt will be to use a Microsoft Azure development workstation VM...

  • User Avatar
    0
    gpcaretti created

    Which version of EntityFramework.DynamicFilters are you using? It has to be 1.4.11, not newer.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @muiscatron,

    Can you send your project to <a href="mailto:[email protected]">[email protected]</a> if you cannot solve the problem.

  • User Avatar
    0
    muiscatron created

    Hi, What is the best way to send a project? I have removed all bin and obj folders but it is still 6MB when compressed.

    thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can also delete the packages folder and it's content. 6MB is good I think, you can upload it to google drive and share it's link with us via <a href="mailto:[email protected]">[email protected]</a>.

    Thanks.

  • User Avatar
    0
    muiscatron created

    Hi, Here is a share link to a google drive folder with the project. I left the log files in the bin folders.

    [https://drive.google.com/drive/folders/0B-1eWo1_sFiXWmFIOWdMSzI4TFE?usp=sharing])

    thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @muiscatron,

    I finally got it :). This is not a problem actually.

    When you first run the application, it tries to navigate "Home/Index" and since HomeController has [AbpMvcAuthorize] attribute, ABP redirects user to login page and writes that log.

    If you don't want to see this log, you can set Account/Login as default route.

    I hope this helps.

  • User Avatar
    0
    meff created

    Dear ismcagdas, after I set Account / Login as default route - after successful authentication I still see a login page and I cannot navigate to any other page :-( So I have to redirect to /home/index in Login action of MVC controller. But then I allways get <a class="postlink" href="http://localhost:1234/home/index#">http://localhost:1234/home/index#</a> in my URL.

    What would be the best way to solve all three problems: *avoid log entry about unauthorized request *redirect to Home / Index after login *keep http(s)://server/# URL without "/home/index"

    Thank you in advance.