You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
比如新建一个CommHub类并继承Hub,我这里初始化了_context,但是在调用的时候提示:
Error when dispatching 'OnConnectedAsync' on hub.
System.InvalidOperationException: Unable to resolve service for type 'XXK.DataContext' while attempting to activate 'XXK.Hubs.CommHub'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method191(Closure , IServiceProvider , Object[] )
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubActivator1.Create() at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher1.OnConnectedAsync(HubConnectionContext connection)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher1.OnConnectedAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler1.RunHubAsync(HubConnectionContext connection)
The text was updated successfully, but these errors were encountered:
比如新建一个CommHub类并继承Hub,我这里初始化了_context,但是在调用的时候提示:
Error when dispatching 'OnConnectedAsync' on hub.
System.InvalidOperationException: Unable to resolve service for type 'XXK.DataContext' while attempting to activate 'XXK.Hubs.CommHub'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method191(Closure , IServiceProvider , Object[] )
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubActivator
1.Create() at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher
1.OnConnectedAsync(HubConnectionContext connection)at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher
1.OnConnectedAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler
1.RunHubAsync(HubConnectionContext connection)The text was updated successfully, but these errors were encountered: