About the author

J Sawyer is a developer based in Houston, TX who absolutely loves to write code. After spending 9 years at Microsoft, he moved on to other things and is currently the Lead Developer for the RealTime Data Management team at Logica US. He spends his days building Really Cool Things around StreamInsight and having a blast doing it.

He has been involved with HDNUG, one of the oldest and largest .NET-focused user groups in the US, since its inception in 2001 and has watched it grow from 5-10 technologists meeting around a conference table to a thriving community of over 5000 with regular meeting attendance averaging 100 attendees. He currently serves as the Vice President. You can join him at HDNUG on the second Thursday of every month at the Houston Microsoft office.

He also loves to ride his Yamaha FZ1. And sometimes his Ninja 650. And also his Honday XR-400 dirt bike. But he doesn't code and ride at the same time. That would be bad.

StreamInsight : What edition am I running?

June 13, 2011 12:38 PM

It is sometimes helpful to know what edition and/or version of StreamInsight you are using. This can be especially helpful as part of your application startup, where you can log this information for future/current troubleshooting. Unfortunately, there isn’t a good way to get that information from the StreamInsight API. Sure, you can use one of the Diagnostic Views – the scheduler diagnostic view – that will tell you how many schedulers are running, which will give you an idea of which edition you are running but it doesn’t provide things like the processor architecture installed (x86 vs. x64) nor will it tell you the exact edition of the instance. Oh … and that diagnostic view isn’t there in version 1.2. You’ll just know whether you are running Standard (1 scheduler) or one of Developer, DataCenter or Evaluation (1 scheduler / core). So here’s a little code snippet that will give you some more information:

/// <summary>
/// Gets information about the current StreamInsight service edition
/// </summary>
/// <param name="instanceName">Name of the StreamInsight instance.</param>
/// <returns>String with edition information</returns>
[System.Security.Permissions.RegistryPermission(
    SecurityAction.Demand, Read="HKLM\\SOFTWARE\\Microsoft\\Microsoft StreamInsight")]
public string GetStreamInsightEditionInformation(string instanceName)
{
    try
    {
        var streamInsightRegistry = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( 
            @"SOFTWARE\Microsoft\Microsoft StreamInsight", false );
        var instanceKeyName = "MSSI." + instanceName;
        var instanceRegistryKey = streamInsightRegistry.OpenSubKey( instanceKeyName, false );
        StringBuilder sb = new StringBuilder();
        sb.Append( "StreamInsight Version:" );
        sb.AppendLine( instanceRegistryKey.GetValue( "Version" ).ToString() );
        sb.Append( "Edition:" );
        sb.AppendLine( instanceRegistryKey.GetValue( "Edition" ).ToString() );
        sb.Append(  "Platform:" );
        sb.AppendLine( instanceRegistryKey.GetValue( "PlatformId" ).ToString() );
        return sb.ToString();
    }
    catch
    {
        return "Could not get StreamInsight information";
    }
}

Some caveats: this will only work on the same machine where StreamInsight is running. So if you are connecting to StreamInsight remotely using the Management Service (for example, to a remote instance of the StreamInsight service), this won’t work for you. Also, it tells you the version of StreamInsight that the instance was installed with – which may not necessarily be the instance that you are running!!! For example, you can have a 1.0 instance, a 1.1 instance and a 1.2 instance. If you use Server.Create(“1.0 Instance”), you will actually be running StreamInsight 1.2! Fortunately, the Server object does have a Version property that will tell you which version you are running.

Tags:

Code Sample | StreamInsight