First off, I know very little about signalR. I'm trying to learn and I'm just messing around mostly.
Running on .NET Core 3.1.
I have 2 machines:
I've created the Chat app from the Getting Started with SignalR.
If I host this in IIS on PC1 it all works fine. The SignalR connection is established and I can send messages from PC1, PC2 Ubuntu, PC2 Win10 VM, and even my phone. Any device on the network can connect to the hub just fine while there is no authentication in place.
If I add Cookie Authentication loading the site will redirect to the login page, login will be successful, and the user will be redirected back to the main index page.
However, only a machine that is part of the domain can establish a SignalR connection after login. This means PC1 can login and establish a signalR connection and send messages.
PC2 ubuntu can login, but get an Unauthorized error when trying to establish a SignalR connection.
PC2 ubuntu/Win10 VM (Which is on the domain) can login, but get an Unauthorized error when trying to establish a SignalR connection.
Using my phone I get the same Unauthorized error.
If a work colleague, who is part of the domain, loads the site on his machine, he can login and establish a working SignalR connection.
When authentication is active, no device that is NOT part of the domain can establish a working SignalR connection.
Any device that is NOT part of the domain get a Unauthorized 401 error when trying to establish a connection to the Hub after login.
Any device that IS part of the domain can login and establish a working SignalR connection with no errors.
The code seems to work fine. I'm thinking it's an IIS issue. My IIS setup is based on this: https://damienbod.com/2018/09/21/deploying-an-asp-net-core-application-to-windows-iis/
It all seems to work and run fine as far as the code is concerned, but a device that is NOT part of the domain cannot establish a signalR connection when Authentication is active.
If there is no authentication, ANY device on the network can connect to the hub just fine.
Again, this is just me messing around and trying to learn what I can or cannot, OR, should or should not do. And yes, I did Google this A LOT.
Hub code:
I got it working... posting this in case it might help someone else and spare them many days of getting nowhere :)
It turns out the Windows domain does not play a role. None of the devices/machines on the network can make a signalr connection over the network if I have authorization active in the app. Only the machine where the IIS is running can open the app, login, and make a signalR connection and work as intended.
Yesterday I happen to watch a video about publishing .net core apps to IIS in Win10 and the guy created a new site under IIS instead of creating a new application under the Default Site that comes with the IIS install.
Decided to give this a go and sure enough the app started working when hosted under a new site in IIS.
I don't know if there is a setup issue on the Default Site... I'm the only one that uses this IIS install and I know I didn't change any of the Default Web Site settings. The win10 install is also only about 6 month old.
I want to test with a fresh install of IIS on a Win10 laptop we have here at work to see if the same issue comes up... I doubt it, but might be worth checking anyway.