locked
SignalR Client application can't make hub connection if it runs as different user level with the SignalR Server process RRS feed

  • Question

  • User208271104 posted

    Hi all, I am running into an issue with SignalR Server/Client appliations if these two processes starting with different user levels, which is required by our design. I am using Visual Studio 2015 in C#, AspNet.SignalR 2.21, and Owin 2.1.

    Any help would be greatly appreciated. TIA!

    The error message is something like this:

    ************** Exception Text ************** System.AggregateException: One or more errors occurred. ---> Microsoft.AspNet.SignalR.Client.HttpClientException: StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: {   Date: Thu, 01 Jun 2017 19:17:41 GMT   Server: Microsoft-HTTPAPI/2.0   Content-Length: 0 }    at Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.<>c__DisplayClass5_0.<Get>b__1(HttpResponseMessage responseMessage)    at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass31_0`2.<Then>b__0(Task`1 t)    at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners`2.<>c__DisplayClass3_0.<RunTask>b__0(Task`1 t)    --- End of inner exception stack trace ---    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)    at System.Threading.Tasks.Task.Wait()

    Thursday, June 1, 2017 7:35 PM

All replies

  • User1967761114 posted

    Hi Kev_EP,<o:p></o:p>

    Is it possible to have a relationship with the user's permission?<o:p></o:p>

    That’s so difficult to provide you correct suggest according to your description.<o:p></o:p>

    Could you provide more details about your issue.<o:p></o:p>

    Such as:<o:p></o:p>

    The correct exception(the exception information you provide doesn’t contain useful information, in this scenario, you could provide the inner exception).<o:p></o:p>

    Some describe for the feature of code.<o:p></o:p>

    The part of the code which occurred the exception.<o:p></o:p>

     

    Best Regards<o:p></o:p>

    Even<o:p></o:p>

    Friday, June 2, 2017 8:33 AM
  • User208271104 posted

    Thank you Even for your reply a while ago. I was working on another project right after my previous post and your reply. Now, as I am back working on this Signalr project I still have the same issue. I have attached my server/client test projects in this post so you can build/run to best explain the problems I am facing on.

    The requirements are: (1) runing the Signalr Server project as a non-admin user, and (2) the Signalr cliens can cross-domain communicate with the Server.

    The current problem is: the Server can only run as non-admin user when the connecting url defined as "localhost", not "machine name" or "ip address".

    I have been stuck by this problem for quite a while and really hope you could provide me a solution. I appreciate your efforts/help and thank you in advance!

    namespace ServerApp
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                //const string url = "http://localhost:8088"; // run as non-admin users but failed cross-domain user
                var url = $"http://{Environment.MachineName}:8088"; // not run as non-admin users but communicates with other machines 
                WebApp.Start(url);
    
                Console.WriteLine("Server running on {0}", url);
    
                while (true)
                {
                    var ki = Console.ReadKey(true);
    
                    if (ki.Key == ConsoleKey.X)
                    {
                        break;
                    }
                }
    
                Console.ReadKey();
            }
    
            public class Startup
            {
                public void Configuration(IAppBuilder app)
                {
                    app.UseCors(CorsOptions.AllowAll);
    
                    var hubConfiguration = new HubConfiguration()
                    {
                        EnableDetailedErrors = true,
                        EnableJSONP = true,
                        EnableJavaScriptProxies = true
                    };
    
                    app.MapSignalR(hubConfiguration);
                }
            }
    
            [HubName("MyHub")]
            public class MyHub : Hub
            {
                public void Send(string name, string message)
                {
                    Clients.All.addMessage(name, message);
                }
            }
        }
    }

    Monday, August 14, 2017 4:52 PM