Click here to Skip to main content
15,887,683 members
Articles / Programming Languages / C#
Tip/Trick

Windows Server AppFabric Service Validation

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
4 Feb 2012CPOL 12.7K  
How to test and Ensure that AppFabric Service is up and running
For Web applications, Windows Azure provides caching capabilities to provide high-speed access, scale, and high availability to application data. The AppFabric service "AppFabricCachingService" runs to accommodate the caching and session management infrastructure. The Cache cluster can be started using the powershell.

In order to validate that the service is up and running, the following test can be performed.

C#
namespace AppFabricServiceTest
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            IsServiceRunning();
        }

        private static bool IsServiceRunning()
        {
            bool status = false;
            var sc = new System.ServiceProcess.ServiceController("AppFabricCachingService");
            if (sc.Status == System.ServiceProcess.ServiceControllerStatus.Stopped)
                status = false;
            else
                status = true;

            return status;
        }
    }
}


You would need System.ServiceProcess assembly reference in your project to invoke ServiceController and check the status, i.e., ServiceControllerStatus. This enumeration provides various members including ContinuePending, Pause, PausePending, Running, StartPending, Stopped and StopPending.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Green Dot Corporation
United States United States
Adnan Masood works as a Sr. Software Engineer / Technical Lead in a Monrovia based financial institution where he develops middle tier architectures, distributed systems and web applications using Microsoft .NET framework. He holds various professional memberships (ACM, BCS, and ACS) and several technical certifications including MCSD.NET, MCAD.NET and SCJP-II. Adnan is attributed and published in print media and on the web and holds a Masters Degree in Computer Science from Nova Southeastern University, FL and is currently pursuing his doctoral studies in Machine Learning. Adnan has taught WCF courses at University of California at San Diego and regularly present at local code camps. He is actively involved in the .NET community as co-founder and president of San Gabriel Valley .NET Developers group. His blog can be found at www.AdnanMasood.com and he can be reached via email at adnanmasood at acm.org

Comments and Discussions

 
-- There are no messages in this forum --