I got error when created WebSocketManagerExtensions like this:
System.InvalidOperationException
A suitable constructor for type
'CustomerManagementCore.WebSocketManager.WebSocketManagerMiddleware' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
MapWebSocketManager
method:
public static IApplicationBuilder MapWebSocketManager(this IApplicationBuilder app,
PathString path,
WebSocketHandler handler)
{
return app.Map(path, (_app) => _app.UseMiddleware<WebSocketManagerMiddleware>(handler));
}
WebSocketManagerMiddleware
constructor:
public WebSocketManagerMiddleware(RequestDelegate next,
WebSocketHandler webSocketHandler)
{
_next = next;
_webSocketHandler = webSocketHandler;
}
I know if there is something error with my WebSocketManagerMiddleware
constructor, but I have no idea.
Anyone know?
Thanks.