Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Chat: Error on SendMessage #5580


User avatar
0
alexanderpilhar created

I'm currently receiving error-notification when trying to send a message in chat (both on my dev environment as well as on demo.apsnetzero.com; both ASP.NET Core & Angular; ASPNETZERO 5.5.0):

[attachment=0:3evupvak]aspnetzero-chat-send_message-error-20180908.png[/attachment:3evupvak]

AppService method does not get called. There are no errors logged to browser console.

Please, confirm whether there is a problem in ASPNETZERO 5.5.0? If not, why do I encounter this error on demo.aspnetzero.com as well?


6 Answer(s)
  • User Avatar
    0
    alexanderpilhar created

    Additional Information:

    I was working on a feature using SignalR. Hub was working as expected, only when i switched to use the Hub through IHubContext<MyHubName> (just like in SignalRChatCommunicator.cs) I realized that it didn't work at all - the client never received any messages. After trying to debug without success, I checked if chat was working properly (as it also uses IHubContext) - which doesn't seem to be the case ...

  • User Avatar
    0
    ismcagdas created
    Support Team

    @alexanderpilhar I just checked on demo.aspnetzero.com and it worked for me. Do you have any error messages in Logs.txt ?

  • User Avatar
    0
    alexanderpilhar created

    @ismcagdas I just checked demo.aspnetzero.com with different browsers and it works as expected in current version of Firefox and Chrome. In Edge it got error notifications when I tried to send messages. Now it kind of works as long as the user I want to chat with is logged in. But the messages do not get displayed in chat window - I need to refresh the page to see latest messages. Anyway, this looks like there is an issue with Edge and not with ASPNETZERO.

    In dev-environment it still doesn't work in any of the browsers. Here are the log-entries from Logs.txt (opened chat and tried to send a single message):

    INFO  2018-09-10 10:11:21,605 [22   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://localhost:22742/api/services/app/Chat/GetUserChatMessages?UserId=1  
    INFO  2018-09-10 10:11:21,605 [22   ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
    INFO  2018-09-10 10:11:21,605 [22   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.2934ms 204 
    INFO  2018-09-10 10:11:21,619 [23   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/api/services/app/Chat/GetUserChatMessages?UserId=1 application/json 
    INFO  2018-09-10 10:11:21,619 [23   ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
    INFO  2018-09-10 10:11:21,619 [23   ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
    WARN  2018-09-10 10:11:21,619 [23   ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported cultures 'null'.
    WARN  2018-09-10 10:11:21,619 [23   ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported UI Cultures 'null'.
    INFO  2018-09-10 10:11:21,627 [23   ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {area = "app", action = "GetUserChatMessages", controller = "Chat"}. Executing action CompanyName.ProjectName.Chat.ChatAppService.GetUserChatMessages (CompanyName.ProjectName.Application)
    INFO  2018-09-10 10:11:21,627 [23   ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
    INFO  2018-09-10 10:11:21,635 [23   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method CompanyName.ProjectName.Chat.ChatAppService.GetUserChatMessages (CompanyName.ProjectName.Application) with arguments (CompanyName.ProjectName.Chat.Dto.GetUserChatMessagesInput) - Validation state: Valid
    INFO  2018-09-10 10:11:21,685 [4    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method CompanyName.ProjectName.Chat.ChatAppService.GetUserChatMessages (CompanyName.ProjectName.Application), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 49.1124ms.
    INFO  2018-09-10 10:11:21,685 [4    ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
    INFO  2018-09-10 10:11:21,687 [4    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action CompanyName.ProjectName.Chat.ChatAppService.GetUserChatMessages (CompanyName.ProjectName.Application) in 60.0389ms
    INFO  2018-09-10 10:11:21,688 [4    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 68.9666ms 200 application/json; charset=utf-8
    WARN  2018-09-10 10:11:32,698 [23   ] CompanyName.ProjectName.Web.Chat.SignalR.ChatHub  - Could not send chat message to user: 1
    WARN  2018-09-10 10:11:32,704 [23   ] CompanyName.ProjectName.Web.Chat.SignalR.ChatHub  - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
       at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__19.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.Authorization.AuthorizationHelper.<CheckPermissions>d__22.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.Authorization.AuthorizationHelper.<AuthorizeAsync>d__20.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 Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
       at System.Threading.Tasks.Task.Execute()
    --- 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 Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
       at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
       at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo, Type type)
       at Abp.Authorization.AuthorizationInterceptor.Intercept(IInvocation invocation)
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.Proxies.ChatMessageManagerProxy.SendMessageAsync(UserIdentifier sender, UserIdentifier receiver, String message, String senderTenancyName, String senderUserName, Nullable`1 senderProfilePictureId)
       at CompanyName.ProjectName.Web.Chat.SignalR.ChatHub.<SendMessage>d__5.MoveNext()
    Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
       at Abp.Authorization.AuthorizationHelper.<AuthorizeAsync>d__19.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.Authorization.AuthorizationHelper.<CheckPermissions>d__22.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.Authorization.AuthorizationHelper.<AuthorizeAsync>d__20.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 Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
       at System.Threading.Tasks.Task.Execute()
    --- 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 Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
       at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
       at Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo, Type type)
       at Abp.Authorization.AuthorizationInterceptor.Intercept(IInvocation invocation)
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.Proxies.ChatMessageManagerProxy.SendMessageAsync(UserIdentifier sender, UserIdentifier receiver, String message, String senderTenancyName, String senderUserName, Nullable`1 senderProfilePictureId)
       at CompanyName.ProjectName.Web.Chat.SignalR.ChatHub.<SendMessage>d__5.MoveNext()
    
  • User Avatar
    0
    alexanderpilhar created

    Unmodified ASPNETZERO works as expected. So, there is something wrong with my project … Okay, that's all I wanted to make sure.

  • User Avatar
    0
    alexanderpilhar created

    I was able to figure out the problem and solve it. It was due to a change I falsely made to QueryStringTokenResolver(…) in AuthConfigurer.cs. All is working fine now!

  • User Avatar
    0
    ismcagdas created
    Support Team

    @alexanderpilhar Thanks :)