在ASP.NET版本中,它非常简单:
hubConnection.Credentials = CredentialCache.DefaultNetworkCredentials;
如何在新的AspNetCore C#托管客户端中实现这一目标?
答案 0 :(得分:1)
您可以在“ WithUrl”的选项内完成此操作
HubConnection connection = new HubConnectionBuilder()
.WithUrl("/chatHub", o => { o.Credentials = CredentialCache.DefaultNetworkCredentials; })
.Build();