Hi @drg, This may help you: Simple SignalR implementation
Hi @ismcagdas, I may be taking you up on that offer to dig deeper.
For some reason the standard implementation of Application Insights in the Zero project does not complete the installation. What was missing was this line in Web.Host Startup.cs:
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//BI 20191115 0.14.1
// The following line enables Application Insights telemetry collection.
services.AddApplicationInsightsTelemetry();
Hope this helps someone else.
Does anyone have any guidance for implementing Application Insights into Zero?
I know this issue is closed but I also believe there is some trick to getting Application Insights to work in the Zero framework. @walkerscott is it possible for you to share your thoughts/code on this?
Hi @ismcagdas, Interestingly enough the value is set in my appsettings.json but not in my appsettings.production.json. Is your recommendation that I should set the value of AllowAnonymousSignalRConnection in my production file to true?
Hi @ismacagdas, I had already found "Writing is not allowed after writer was completed", with SignalR 1.1" which seems to suggest it's a benign message and possibly updated in a later version of SignalR, I have no idea which version of SignalR I am using because I only have Abp.AspNetCore.SignalR which is on version 4.4.0. If you're saying that SignalR should already be authorised how is it possible for it to continue working after expiration?
Hi @ismcagdas, I am currently working with datadog to try find the root cause, I am up to my ears in logs! I have UK Fast (the UK's largest Azure consultancy) also trying to track the problem. Too early to say whether it's my code or Azure, I'm sure it's not Zero. As for
Note the three FATAL messages which we have been told to ignore because "Zero continues to operate normally so just ignore these messages". Hardly professional but hey-ho there we go.
See Microsoft.AspNetCore.AzureAppServices.HostingStartup problem. Comments welcome.
@ismcagdas, I have some errors in my logs with regard to SignalR for the first time and I suspect it is from the above implementation.
INFO 2019-10-05 19:07:58,348 [74 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Nuagecare.Tenants.Dashboard.TenantDashboardAppService.GetFormSubmissionActivityByStaffForChart (Nuagecare.Application), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 1344.7239ms.
INFO 2019-10-05 19:08:17,600 [80 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 20286.381ms 101
DEBUG 2019-10-05 19:08:21,756 [109 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: 5o4znj9JHWHyVaLsqW5VpQ
DEBUG 2019-10-05 19:08:22,771 [39 ] Nuagecare.Web.Chat.SignalR.ChatHub - A client is disconnected: X6rtAAzycni2NZ6dSH3KSw
ERROR 2019-10-05 19:08:23,787 [109 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
ERROR 2019-10-05 19:08:23,787 [109 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
INFO 2019-10-05 19:08:26,756 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 4579899.7844ms 101
INFO 2019-10-05 19:08:27,834 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 4580877.9993ms 101
DEBUG 2019-10-05 19:08:29,865 [39 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: 5w7N5t6kRGAuhLw7we98nA
DEBUG 2019-10-05 19:08:29,865 [109 ] Nuagecare.Web.Chat.SignalR.ChatHub - A client is disconnected: Hhx2T-pD_ZqRnbFltQbOuQ
DEBUG 2019-10-05 19:08:30,881 [39 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: wqcCGN_gb_noqrsQQgLMeg
DEBUG 2019-10-05 19:08:30,881 [37 ] Nuagecare.Web.Chat.SignalR.ChatHub - A client is disconnected: AYzqNH3HvZbSQKykQv6v9Q
ERROR 2019-10-05 19:08:31,896 [37 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
INFO 2019-10-05 19:08:32,912 [38 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HLQ8ED367GOK", Request id "0HLQ8ED367GOK:00000011": the connection was closed because the response was not read by the client at the specified minimum data rate.
INFO 2019-10-05 19:08:34,912 [120 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 3277540.3999ms 101
INFO 2019-10-05 19:08:34,943 [32 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 3277687.8381ms 101
INFO 2019-10-05 19:08:34,943 [112 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HLQ8ED367GOI", Request id "0HLQ8ED367GOI:0000000F": the connection was closed because the response was not read by the client at the specified minimum data rate.
INFO 2019-10-05 19:08:35,897 [109 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 13730904.8477ms 101
INFO 2019-10-05 19:08:35,928 [32 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 13730829.5871ms 101
DEBUG 2019-10-05 19:08:35,959 [112 ] Nuagecare.Web.Chat.SignalR.ChatHub - A client is disconnected: Z-hFhgptsMNrdnm73RDuhQ
DEBUG 2019-10-05 19:08:35,959 [109 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: SZETRL1vsi6cqONnHh7yFg
DEBUG 2019-10-05 19:08:35,959 [37 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: WDBrDzCQZ69KwqbjkNKFFg
DEBUG 2019-10-05 19:08:35,959 [38 ] nalR.FormSubmissionHub.FormSubmissionHub - A client disconnected from FormSubmissionHub: ECHbXWFhvQDoA5n639DXpQ
ERROR 2019-10-05 19:08:36,975 [37 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
ERROR 2019-10-05 19:08:36,975 [37 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
DEBUG 2019-10-05 19:08:37,990 [112 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is disconnected: rRDEBOcsg6HaKs54UWmRyg
DEBUG 2019-10-05 19:08:37,990 [38 ] Nuagecare.Web.Chat.SignalR.ChatHub - A client is disconnected: 1x-ARxK-4NfhpmaW0wecFw
ERROR 2019-10-05 19:08:39,006 [109 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
ERROR 2019-10-05 19:08:39,006 [109 ] .AspNetCore.SignalR.HubConnectionContext - Failed writing message. Aborting connection.
System.InvalidOperationException: Writing is not allowed after writer was completed.
at System.IO.Pipelines.Pipe.GetMemory(Int32 sizeHint)
at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint)
at System.IO.Pipelines.PipeWriter.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.HubConnectionContext.<TryWritePingSlowAsync>d__49.MoveNext()
INFO 2019-10-05 19:08:40,975 [120 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 16790141.1665ms 101
INFO 2019-10-05 19:08:40,975 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 429979.9867ms 101
INFO 2019-10-05 19:08:40,975 [39 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 16790482.9874ms 101
INFO 2019-10-05 19:08:40,975 [80 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 430085.5001ms 101
INFO 2019-10-05 19:08:41,037 [112 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HLQ8ED367GOV", Request id "0HLQ8ED367GOV:00000014": the connection was closed because the response was not read by the client at the specified minimum data rate.
INFO 2019-10-05 19:08:41,428 [39 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcEntity/GetFormsForEntity?input=56907702-ae3e-4cbd-1770-08d5f63eb2e7
INFO 2019-10-05 19:08:41,428 [39 ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO 2019-10-05 19:08:41,428 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 17728315.9452ms 101
INFO 2019-10-05 19:08:41,443 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcForm/SubmitForms
INFO 2019-10-05 19:08:41,443 [51 ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO 2019-10-05 19:08:41,443 [51 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 5.4954ms 204
INFO 2019-10-05 19:08:41,443 [112 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://nuagecarewebapi.azurewebsites.net/
INFO 2019-10-05 19:08:41,443 [112 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Nuagecare.Web.Controllers.HomeController.Index (Nuagecare.Web.Host)'
INFO 2019-10-05 19:08:41,443 [112 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "Index", controller = "Home", area = ""}. Executing action Nuagecare.Web.Controllers.HomeController.Index (Nuagecare.Web.Host)
INFO 2019-10-05 19:08:41,459 [112 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Nuagecare.Web.Controllers.HomeController.Index (Nuagecare.Web.Host) - Validation state: Valid
INFO 2019-10-05 19:08:41,428 [37 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcEntity/GetFormsForEntity?input=7e334e4c-db3f-4900-2853-08d6a6218745
INFO 2019-10-05 19:08:41,428 [120 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcEntity/GetFormsForEntity?input=66ae3b69-0eaf-489f-1769-08d5f63eb2e7
INFO 2019-10-05 19:08:41,428 [32 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 17728297.6264ms 101
INFO 2019-10-05 19:08:41,459 [100 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcEntity/GetFormsForEntity?input=dce6ebdb-fc90-4aa6-1771-08d5f63eb2e7
INFO 2019-10-05 19:08:41,459 [112 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Nuagecare.Web.Controllers.HomeController.Index (Nuagecare.Web.Host), returned result Microsoft.AspNetCore.Mvc.RedirectToActionResult in 0.0518ms.
INFO 2019-10-05 19:08:41,459 [37 ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO 2019-10-05 19:08:41,490 [37 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 57.5895ms 204
INFO 2019-10-05 19:08:41,475 [33 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://beverley.nuagecare.io/signalr/negotiate?enc_auth_token=wNYmO41%2F48SHNstaLVXxHCCre29BZQl1NhC6NM3R3rzpXtPQxVzH6jEzA%2FQhXFN5tu6Fk7pO53uppm1mVXMZgxbyRVz26dnepi%2FFyB6axBY%2B6gq1GL%2BuRQgoiFUCjRN2p8w6LevViwKlHyWZZJZO1DGVSjAi1m2U%2Bog9pkHw9%2FSx%2Bo570np2k82P6w%2FormNXR9PL41u7oSMKLOXt0GwuLYro99gg8VeT3cl1X4tKr7w%2FEKe17nck8u0uyzYKEm%2Fn%2BFbG0l1Vc%2B5X2BpYXoGVkFiwXXP34yArvijtwXX3VvR7JY7LekO%2B7Bp4qQpkbydhoCGUcIOBe5PPn7%2BR8WNI%2Bt2q24jimq5Bb5K9t3qhip9pjqs14ViIBbvPhxb77pmFk1nvczZXhcBXOP5RhxLxwxiBwOcxHoHkohS4i0skJrr7w9%2BYtEJXEbOc5rxLbt65Na71jBU6ZyXjYGd68S3OniWP4SKVOwkmRDSPeI%2F8Sy6cbohH%2B5Yeveb5to6u7z%2BQl35SLiK%2Frtn5JaJjqV6ioNOmUbemunGuFymOfwo73HJtIB3FEkCkHq%2FMfioPRYaJfsNdGgK3begAGQMf01613lkubrz3X%2FdQHWScIAjb3lG2xVArf4pMwPyFODhqL3JAdvm6hYNS7zbU67LJE3SoE%2FYub8kYn02Gx%2FJcHJ98HoP0lPG3%2BeUBOiZCH7GbPFV5%2Fc5qozkeDooPy21QRDTa7QetvfQrW0ecynjn%2Bu%2BYJfV82VI2ZWCznZPRRx9ddxZIJjtvLY0nKPYHOxghgzv7R05Q8ZpyMuYxHo9ceaNGrh7eBqtUiFMCaselb8Wx1xKmpHU1FuUkg%2BA%2BnKm5gb2KvOORTlzp%2F%2BG6rMjs7q1wqdmJyq%2BtUCoOtTC8Lud%2BrTPVRu7cNXeZHg%2BxfqfeyFHmI9%2B09182uqntVkMLlKfIj88imfskDQ8nTvCrRU6RTC5W1UUcHjocdQ9C7GYyFpzeVnQ8WSuIJwAUhNL2ZZjluEdXJRTMsJbmQis1HQL%2Fh6zrILORO24nkoFnryUTsvnLWTMhPZzDU8mAKR4v1AV94mx5ccEPBO8tqBbKM7pt12nsdYTOZzqEo4WW%2Brc6UMaXEbpmlN7QK%2FSIviQ8PnG%2BozdZ1kEmTOa2arLwGsqSntaG
INFO 2019-10-05 19:08:41,475 [120 ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO 2019-10-05 19:08:41,490 [120 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 62.4998ms 204
INFO 2019-10-05 19:08:41,475 [100 ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO 2019-10-05 19:08:41,490 [112 ] ft.AspNetCore.Mvc.RedirectToActionResult - Executing RedirectResult, redirecting to /Ui.
INFO 2019-10-05 19:08:41,428 [38 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcForm/SubmitForms
INFO 2019-10-05 19:08:41,490 [100 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 40.2434ms 204
INFO 2019-10-05 19:08:41,506 [112 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Nuagecare.Web.Controllers.HomeController.Index (Nuagecare.Web.Host) in 46.8225ms
INFO 2019-10-05 19:08:41,428 [39 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 3.3461ms 204
INFO 2019-10-05 19:08:41,475 [43 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://nuagecare.io/api/services/app/NcForm/SubmitForms
How does SignalR work with authorisation? In other words, I have a dashboard open on the host which displays real time data using SignalR. Once the authorisation for the user expires SignalR continues, is this likely to cause the above errors? If so how do I authorise SignalR or get it to log the user out without raising these errors??
Hi @demirmusa, the problem was one of closure within javascript, as explained in the first answer here: setTimeout not working inside forEach. My refactored code is as below (note the use of the index parameter when setting the timeout at the end.
selectedDocumentTemplates.forEach((item, index) => {
setTimeout(function () {
item = item.replace('dt_', '');
input.ncDocumentTemplateId = item;
console.log(input.ncDocumentTemplateId);
self._ncDocumentService.createDefaultDocument(input)
.subscribe((documentDto) => {
self.newDocumentLoaded.emit(documentDto);
if (index === selectedDocumentTemplates.length - 1) {
self.allDocumentsLoaded.emit(true);
setTimeout(function () {
self.showModalForDocumentsLoading.emit(undefined);
}, 5000);
}
});
}, 5000 * (index + 1));
});
Thanks for your help.