Sreenath G

Sreenath G

  • NA
  • 233
  • 310.6k

How to differentiate windows service and web services in ASP.Net servicecontroller

Jun 6 2011 1:16 AM
 

 

Hi,

I have this code and I want to display all windows services and Web services separately. Is there any extension or any other logic to differentiate this? For example .asmx and .svc extensions will give us web services..

 

ServiceController[] lFnGetAllServicesInServer(string aStrServer)

        {

 

            ServiceController[] lArrObjServiceController = null;

 

            try

            {

 

                System.Security.Principal.WindowsImpersonationContext lObjImpersonationContext = null;

 

                lObjImpersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();

 

                lArrObjServiceController = ServiceController.GetServices(aStrServer.Trim());

 

                lObjImpersonationContext.Undo();

 

                return lArrObjServiceController;

 

            }

            catch (Exception ex)

            {

                return lArrObjServiceController;

            }

 

        }

 

Any suggestions please..

 

Thanks

Sreenath


Answers (4)