I am getting this error for no reason. Initially after app pool restart app works ok for some time. Then this error pops up to all clients.
Windows 2016, all updates installed
Microsoft.NETCore.App 8.0.12
Wisej 3.5.16
Here are 2 screenshots from Web Browser console when error appears.
Also in the browser where this happens, if I disable cache, page reloads correctly.
Here is update as it is randomly popping up so hard to trace
Could it be that some web sockets are cached or re-used so browser still thinks that app is not working. This continues with problematic browser despite WWW Service on server restarted or app pool recycled.
After one client bumps on this error, it spreads to all clients currently using app.
Here s what I see in Application log when errors start to happend
Category: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
EventId: 2
SpanId: f8c5e4f5aa4314c1
TraceId: 718d4c1acc70e0ebb55480a27e6c46bf
ParentId: 0000000000000000
RequestId: 800021bf-0000-fb00-b63f-84710c7967bb
RequestPath: /xPortal/ws.wx
Connection ID “18086456105130533310”, Request ID “800021bf-0000-fb00-b63f-84710c7967bb”: An unhandled exception was thrown by the application.
Exception:
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
— End of stack trace from previous location —
at Wisej.Core.HttpHandler.ProcessWebSocketRequest(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
Hi Dino,
did you try Application.StartTask() as suggested by Luca? The code snippet you posted is incomplete.
We need a fully compilable test case to try to help you here.
Best regards
Frank
This solution was working OK until I moved to .net 8.0 and latest wisej version.
I am using a very simple background service that is sending mails in background (see attachement). Could it be the case that Application.Update is the problem?
The only interaction with GUI is by using service event handlers for messaging to update txt field.
private void BackgroundService_Message(object sender, BackgroundServiceEmailing.BackgroundServiceEmailingEventArgs e)
{
// Application.Update() can optionally call a code block in context before updating the UI.
Application.Update(this, () =>
{
this.txtSendLog.Text = DateTime.Now.ToString() + “: ” + e.Message + Environment.NewLine + txtSendLog.Text;
});
}
If you can reproduce in a small test case, we can look into it in case it is a bug with Wisej and not your own code. However, it’s likely that this issue is not easy to reproduce in a small test case.
Unfortunately, debugging your application is something that is out of scope of this free support forum.
Your options are to downgrade your version of Wisej as that seems to fix the bug, or to purchase a premium support package here: https://wisej.com/services-packages/
This error never popped out until I migrated from Wisej 3.1.12 on .net 6.0 to 3.5.16 and .net 8.0
In the whole codebase there is no call to Application.StartTask().
I am suing System.Threading for BackgroundService and ThreadStart() but this was not a problem so far.
Please login first to submit.