Cassia method works fine in console app but error in asp.net app

StackOverflow https://stackoverflow.com/questions/22682580

  •  22-06-2023
  •  | 
  •  

سؤال

I am running this code.

server.Open();
        //Console.WriteLine("----------------------------------------------------");
        //Console.WriteLine("Active users on {0}", machineName);
        foreach (ITerminalServicesSession session in server.GetSessions())
        {
            System.Security.Principal.NTAccount account = session.UserAccount;
            if (account != null)
            {
                if (session.ConnectionState == Cassia.ConnectionState.Active)
                {
                    ((TextBox)Page.FindControl("txt" + machineName.Substring(7))).Text += session.UserName + " idle " + session.IdleTime.TotalMinutes + " minutes" + "\r\n";
                }
            }
        }

It runs fine in console application but gives "No more data is available " error in asp.net page.

هل كانت مفيدة؟

المحلول

I created a new Application Pool in IIS 7 and set its identity as my personal username instead of the default AppIdenitity. Then I assigned this new Application Pool to my ASP.NET web application in IIS. Issue fixed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top