SignalR connection Access mdb throw excption

0

this code:

 public override async Task OnConnected()
    {
        var conStr = System.Configuration.ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;
        object result = null;
        using (var con = new System.Data.OleDb.OleDbConnection(conStr))
        {
            await con.OpenAsync();
            using (var cmd = con.CreateCommand())
            {
                cmd.CommandText = "SELECT COUNT(1) FROM [USERINFO]";
                result = await cmd.ExecuteScalarAsync();
            }
        }
        await base.OnConnected();
    }

When I connect to the MDB database Result returns the correct result But SingalR outputs Excption in console

this Exciption info:

10:13:33.0924909 - 114c1180-26c0-488f-a489-f11802991ea8 - OnError(System.Net.WebSockets.WebSocketException (0x80004005):  System.Net.Sockets.SocketException (0x80004005): 
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Net.WebSockets.WebSocketConnectionStream.<ReadAsync>d__21.MoveNext()

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
System.Net.WebSockets.WebSocketBase.WebSocketOperation.<Process>d__19.MoveNext()

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Net.WebSockets.WebSocketBase.<ReceiveAsyncCore>d__45.MoveNext()
System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException(String methodName, Exception exception, CancellationToken cancellationToken, Boolean aborted)
System.Net.WebSockets.WebSocketBase.<ReceiveAsyncCore>d__45.MoveNext()

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNet.SignalR.WebSockets.WebSocketMessageReader.<ReadMessageAsync>d__3.MoveNext()

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler.d__25.MoveNext())

This client throw a Excipton:The remote host forced the closure of an existing connection; But I use Npgsql connected Postgre is ok;

c#
.net
signalr
asked on Stack Overflow Aug 15, 2020 by raozhihao

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0