Click here to Skip to main content
15,915,770 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Joining Multiple Tables SQL Query Problem Pin
ratchoy01022-Jul-15 4:07
ratchoy01022-Jul-15 4:07 
GeneralRe: Joining Multiple Tables SQL Query Problem Pin
Dave Kreskowiak22-Jul-15 4:55
mveDave Kreskowiak22-Jul-15 4:55 
GeneralRe: Joining Multiple Tables SQL Query Problem Pin
Richard Deeming22-Jul-15 7:38
mveRichard Deeming22-Jul-15 7:38 
QuestionIs it possible to add Custom Suggestions to google.maps.places.Autocomplete Pin
sr15915-Jul-15 23:59
sr15915-Jul-15 23:59 
AnswerRe: Is it possible to add Custom Suggestions to google.maps.places.Autocomplete Pin
Dave Kreskowiak17-Jul-15 3:58
mveDave Kreskowiak17-Jul-15 3:58 
QuestionAsp.net front and back end confusion! Pin
George Tourtsinakis10-Jul-15 5:06
George Tourtsinakis10-Jul-15 5:06 
AnswerRe: Asp.net front and back end confusion! Pin
Pete O'Hanlon10-Jul-15 5:28
mvePete O'Hanlon10-Jul-15 5:28 
GeneralRe: Asp.net front and back end confusion! Pin
George Tourtsinakis12-Jul-15 3:59
George Tourtsinakis12-Jul-15 3:59 
GeneralRe: Asp.net front and back end confusion! Pin
Dave Kreskowiak12-Jul-15 4:29
mveDave Kreskowiak12-Jul-15 4:29 
GeneralRe: Asp.net front and back end confusion! Pin
George Tourtsinakis18-Jul-15 23:16
George Tourtsinakis18-Jul-15 23:16 
QuestionClone child gridview in nested gridview Pin
Member 118269799-Jul-15 21:20
Member 118269799-Jul-15 21:20 
AnswerRe: Clone child gridview in nested gridview Pin
User 418025428-Jul-15 8:54
User 418025428-Jul-15 8:54 
QuestionHow to get Memory usage size of each services running on Application Server using C#.net Pin
ven7538-Jul-15 20:18
ven7538-Jul-15 20:18 
AnswerRe: How to get Memory usage size of each services running on Application Server Pin
Michael_Davies8-Jul-15 20:24
Michael_Davies8-Jul-15 20:24 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
ven7538-Jul-15 20:28
ven7538-Jul-15 20:28 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
Michael_Davies8-Jul-15 21:08
Michael_Davies8-Jul-15 21:08 
In which case start by looking at WMI, you can get the WMICodeCreator from Miscrosoft site which will let you select WMI Objects, view them and their properties and write the code to do the same that you can cut and paste into your application.

For instance:
C#
using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
    public class MyWMIQuery
    {
        public static void Main()
        {
            try
            {
                 ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_Service");

                ManagementObjectSearcher procsearcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_Process");
                String q;

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    if (queryObj["ProcessId"].ToString() != "0")
                    {
                    Console.WriteLine("-----------------------------------");
                                        
                    q = "SELECT * FROM Win32_Process WHERE ProcessId=";
                    q += queryObj["ProcessId"].ToString();

                    procsearcher.Query = new System.Management.ObjectQuery(q);

                    foreach (ManagementObject ProcObj  in procsearcher.Get())
                    {
                        Console.WriteLine("Name: {0} : {1}", queryObj["Name"], ProcObj["WorkingSetSize"]);
                    }
                    }
                }
            }
            catch (ManagementException e)
            {
                MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
            }
        }
    }
}


You can also get the ProcessId which will be non-zero if the service is running, using the ProcessId you can query WMI to get the process information.

Updated the code to get the memory for running Services.

modified 9-Jul-15 5:39am.

GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
ven7538-Jul-15 23:16
ven7538-Jul-15 23:16 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
Michael_Davies8-Jul-15 23:43
Michael_Davies8-Jul-15 23:43 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
ven7539-Jul-15 0:56
ven7539-Jul-15 0:56 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
ven7539-Jul-15 1:43
ven7539-Jul-15 1:43 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
Michael_Davies9-Jul-15 5:11
Michael_Davies9-Jul-15 5:11 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
Pete O'Hanlon9-Jul-15 0:29
mvePete O'Hanlon9-Jul-15 0:29 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
ven7539-Jul-15 0:58
ven7539-Jul-15 0:58 
GeneralRe: How to get Memory usage size of each services running on Application Server using C#.net Pin
Michael_Davies9-Jul-15 5:11
Michael_Davies9-Jul-15 5:11 
Questionhow to make image slider in a simple steps in Asp.Net Pin
Member 118220277-Jul-15 23:58
Member 118220277-Jul-15 23:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.