4,103 questions
You appear to not have provided a custom user id provider required with Windows authentication. See
https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-8.0
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a SignalR server and client written in .NET 6.0, the server is a self hosted Windows Service.
Now I want to use Windows Authentication for authentication, but the problem is that when the client connects to the server within the same machine, the Context.UserIdentifier
got in Server side is null.
Does this mean that authentication has failed?
The client side code
using SignalRClient.Common;
using Microsoft.AspNetCore.SignalR.Client;
using System.Net.Security;
namespace SignalRClient.Connections
{
public class SignalRClient
{
private HubConnection? _hubConnection;
public async Task HubConnection_StartAsync()
{
_hubConnection = new HubConnectionBuilder()
.WithUrl("http://10.224.10.10:12345/simpleHub/", (options) =>
{
options.HttpMessageHandlerFactory = (handler) =>
{
if (handler is HttpClientHandler clientHandler)
{
clientHandler.ServerCertificateCustomValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => { return true; };
}
return handler;
};
options.UseDefaultCredentials = true;
})
.WithAutomaticReconnect()
.Build();
_hubConnection.Closed += HubConnection_Closed;
_hubConnection.Reconnecting += HubConnection_Reconnecting;
_hubConnection.Reconnected += HubConnection_Reconnected;
_hubConnection.On
You appear to not have provided a custom user id provider required with Windows authentication. See
https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-8.0