ServerAgent类连接到服务器错误 [英] Connect to Server error by ServerAgent class

查看:238
本文介绍了ServerAgent类连接到服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sdk示例(如LoggingNotice或Archiver)始终显示错误消息:

错误:无法连接到服务器 - 应用程序未经授权。



错误:服务器不可用 - 应用程序未经授权。
必须在作为"RTC服务器应用程序"成员的帐户下运行。本地组

我检查了这样的代码:

第一个错误是由以下原因引起的:ServerAgent agent = new ServerAgent(app,am);
第二个错误是由以下原因引起的:ServerAgent.WaitForServerAvailable(3);

顺便说一下:我在管理员下运行了这个应用程序,并且管理员已经读了" ; RTC服务器应用程序" group。

为什么以及如何解决?

代码:

The Sdk Samples, like LoggingNotice or Archiver, always shows error message :

ERROR: Unable to connect to server - Application not authorized.

or

ERROR: Server unavailable - Application not authorized.
must be running under an account that is a member of the "RTC Server Application
s" local group

I checked the code like that:

The first error is caused by : ServerAgent agent = new ServerAgent(app, am);
the second error is caused by: ServerAgent.WaitForServerAvailable(3);

By the way: I ran this application under the administrator, and the administrator is alread a mement of "RTC Server Applications" group.

Why and how to solve it?

The code:

namespace SampleUtils
{
    using System;
    using Microsoft.Rtc.Sip;

    public class AppUtils {
        //
        // Static function to connect to Server
        //
        public static ServerAgent ConnectToServer(object app, string amFile)
        {
            try {
                ServerAgent.WaitForServerAvailable(3);      // 3 Attempts
            }
            catch (Exception e1) {
                Console.WriteLine("ERROR: Server unavailable - {0}", e1.Message);
                if (e1 is UnauthorizedException) {
                    Console.WriteLine("must be running under an account that is a member of the \"RTC Server Applications\" local group");
                }
                return null;
            }


            ApplicationManifest am = ApplicationManifest.CreateFromFile(amFile);
            if (am == null) {
                Console.WriteLine("ERROR: {0} application manifest file not found.", amFile);
                return null;
            }

            try {
                am.Compile();
            }a
            catch (CompilerErrorException e2) {
                Console.WriteLine("ERROR: {0} application manifest file contained errors:", amFile);
                foreach( string message in e2.ErrorMessages) {
                    Console.WriteLine(message);
                }
                return null;
            }

            try {
                ServerAgent agent = new ServerAgent(app, am);
                return agent;
            }
            catch (Exception e3) {
                Console.WriteLine("ERROR: Unable to connect to server - {0}", e3.Message);
                return null;
            }
        }
    }
}








推荐答案

("以管理员身份运行")是解决方案

("run as administrator") is the solution

 

尝试以管理员权限运行Visual Studio

Try to run The Visual Studio with administrator privileges

1。通过"以管理员身份运行"

1. Run the *.exe of the application from the bin folder by "run as administrator"

2从bin文件夹运行应用程序的* .exe。开始将* .exe从"Debug ==>"附加到调试器附加到流程"

2. Start to attach the *.exe to the debugger from "Debug ==> Attach to process"

3。视觉工作室将要求您从管理员的优先开始

3. the visual studio will ask you to start with the administrator previlege

 

我希望此帮助


这篇关于ServerAgent类连接到服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆