StatusCode:404,ReasonPhrase:' Not Found',版本:1.1,内容:

时间:2018-04-19 08:34:01

标签: signalr desktop-application

我创建了一个Windows窗体应用程序,并且我已经使用visual studio setup项目在用户本地系统上进行安装。我有以下问题,如果有任何身体可以帮助:

方案: 我已经建立了一个在实时IP上运行的信号服务器。当用户以管理员身份安装应用程序时,与服务器的连接成功建立,但当他没有以管理员身份运行或者他没有任何管理员权限时,他会收到以下错误

StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:

{   Access-Control-Allow-Origin:*   Access-Control-Allow-Headers:Content-Type,Authorization,Accept,X-Requested-With   Access-Control-Allow-Methods:OPTIONS,TRACE,GET,HEAD,POST,PUT   连接:关闭   日期:周一,2018年4月19日08:08:05 GMT   服务器:Microsoft-IIS / 10.0   X-Powered-By:ASP.NET   内容长度:1245   内容类型:text / html }    在Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient。&lt;&gt; c__DisplayClass6_0.b__1(HttpResponseMessage responseMessage)    在Microsoft.AspNet.SignalR.TaskAsyncHelper。&lt;&gt; c__DisplayClass31_0 2.<Then>b__0(Task 1 t)    在Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners 2.<>c__DisplayClass3_0.<RunTask>b__0(Task 1 t) ---从抛出异常的先前位置开始的堆栈跟踪结束---    在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)    在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)    在System.Runtime.CompilerServices.TaskAwaiter.GetResult()    在WindowsPrintingAgent.MainForm.d__16.MoveNext()

我从用户本地系统向服务器发送一些数据作为查询字符串,这里是c#client的代码

 hubConnection = new HubConnection(ServerUrl, "PrintersData=" + GetPrintersData() + "");
            hubConnection.DeadlockErrorTimeout = TimeSpan.FromSeconds(10);  //default is 10 seconds

            hubProxy = hubConnection.CreateHubProxy("printerAgentHub");

            hubConnection.Received += (data) =>
            {
                log.Info(data);
            };

            // When Connection is Slow Always Try to make Request for Connection
            hubConnection.ConnectionSlow += () =>
            {
                // StartSignalRConnections();
                AddListItem("Slow Connection Detected", true);
                log.Info("Connection Slow");
            };

            // When Connection is giving An Error Try to make Request for Connection
            hubConnection.Error += (ex) =>
            {
                AddListItem(ex.Message, true);
                log.Info(ex.Message);
                // StartSignalRConnections();
            };

            hubConnection.Reconnecting += () =>
            {
                // StartSignalRConnections();
                AddListItem("Re Connecting");
                log.Info("Re Connecting");
            };

            hubConnection.Reconnected += () =>
           {
               // StartSignalRConnections();
               AddListItem("Re Connected");
               log.Info("Re Connected");
           };



            // Method whcih Server Will Call for Print
            hubProxy.On<List<object>>("sendMessage", message => SendMessage(message));
            hubProxy.On<string>("connectionStatus", message => connectionStatus(message));

            await hubConnection.Start();

请大家提供任何身体帮助

0 个答案:

没有答案