1

我正在尝试将Cassia与 WCF Web 服务一起使用,但我不断收到“现有连接被远程主机强行关闭”。当我在测试控制台应用程序上尝试它时,它工作正常。这是我从我找到的示例中使用的代码。有人这样做过吗?

public List<ITerminalServicesSession> getTermminalServerSessions(string serverName)
    {
        ConnectionDetails connection = new ConnectionDetails();
        connection.Domain = "DOMAIN";
        connection.Server = serverName;
        connection.Username = "USER";
        connection.Password = "PASSWORD";
        using (ImpersonationHelper.Impersonate(connection))
        {
            using (var server = GetServer(connection.Server))
            {
                server.Open();
                return server.GetSessions().ToList();
            }
        }
    }
4

0 回答 0