I'm hosting my signalR in IIS, and I have a .net client that resides in the same website. I'm using windows authentication so credentials are set this way:
I see the above error in the browser developer tool and it happens when this line is run:
hubConnection.Start().Wait();
I'm pretty sure the credential itself is right, because when I run the site locally, and put in the hub url that's deployed on the server, and pass in a credential for that server, I am able to start the hubConnection.
So what could be something that's preventing the SignalR .Net client from authenticating on a server, but not locally?
SignalR authentication with .NET client works locally but not on server
It seems you have not enable the Windows Authentication in IIS on your Server. Please follow the steps in below:
1. Login to your server machine, and open the IIS manager
2. Select current site in Sties Tree in the left
3. Double click the “Authentication” (configure the authentication settings for sites and applications)
4. Change the “Windows Authentication” status to Enable
Best regards,
Dillion
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
I do have Windows Authentication enabled on the server.
Now I am leaning towards the theory that the credential passed to the .NET client of SignalR doesn't have enough rights. Basically every time I get the 401 error, I can see a new Audit Failure entry popping up in the server's event viewer log, saying the
credential that was used couldn't log on.
Does anyone know what rights need to be granted to the account?
connection.Credentials = new NetworkCredential("username", "password");
If you have any other questions, please feel free to contact me any time.
Best regards,
Dillion
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
2 Posts
SignalR authentication with .NET client works locally but not on server
Apr 21, 2017 07:11 PM|zhaoli86|LINK
I'm hosting my signalR in IIS, and I have a .net client that resides in the same website. I'm using windows authentication so credentials are set this way:
hubConnection.Credentials = CredentialCache.DefaultCredentials;
This all work when I run the site locally, but it would give me a 401 error when deployed on a server:
SignalR: myhub.DoStuff failed to execute. Error: StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Server: Microsoft-IIS/8.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Date: Thu, 20 Apr 2017 19:40:41 GMT
Content-Length: 1293
Content-Type: text/html
}
I see the above error in the browser developer tool and it happens when this line is run:
hubConnection.Start().Wait();
I'm pretty sure the credential itself is right, because when I run the site locally, and put in the hub url that's deployed on the server, and pass in a credential for that server, I am able to start the hubConnection.
So what could be something that's preventing the SignalR .Net client from authenticating on a server, but not locally?
All-Star
45489 Points
7008 Posts
Microsoft
Re: SignalR authentication with .NET client works locally but not on server
Apr 24, 2017 07:07 AM|Zhi Lv - MSFT|LINK
Hi zhaoli86,
It seems you have not enable the Windows Authentication in IIS on your Server. Please follow the steps in below:
1. Login to your server machine, and open the IIS manager
2. Select current site in Sties Tree in the left
3. Double click the “Authentication” (configure the authentication settings for sites and applications)
4. Change the “Windows Authentication” status to Enable
Best regards,
Dillion
None
0 Points
2 Posts
Re: SignalR authentication with .NET client works locally but not on server
Apr 26, 2017 02:28 PM|zhaoli86|LINK
Thanks for your reply.
I do have Windows Authentication enabled on the server.
Now I am leaning towards the theory that the credential passed to the .NET client of SignalR doesn't have enough rights. Basically every time I get the 401 error, I can see a new Audit Failure entry popping up in the server's event viewer log, saying the credential that was used couldn't log on.
Does anyone know what rights need to be granted to the account?
All-Star
45489 Points
7008 Posts
Microsoft
Re: SignalR authentication with .NET client works locally but not on server
May 05, 2017 06:33 AM|Zhi Lv - MSFT|LINK
hi zhaoli86
You could set Credentials like this:
If you have any other questions, please feel free to contact me any time.
Best regards,
Dillion