30 September, 2011

WF persistence service?

As it is very rare that I need to interact with the SqlPersistenceService (and TrackingService), I always seem to forget where on disk these artifacts are. To aid that situation – I’ve compiled the following list:

Persistence:

Step 1: Create a new database on your server
Step 2: Open and run (Sql Query Tool) this script against your newly created database (%WINDIR%\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\<language>\SqlPersistence_Schema)
Step 3:  Open and run (Sql Query Tool) this script against your newlu created database (%WINDIR%\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\<language>\SqlPersistence_Logic)

That’s what there is to it.

StackOverflow Tags:

07 September, 2011

How to read the account name running a Windows Service

I today had to find a way on how to retrieve the account name used for running a (Windows) service on a Windows 7 PC. This actually proved more difficult than first expected – as I did not know where this information is stored in the first place. But, as the value is resurrected at boot of the machine, it must be stored somewhere persistently!

I learned this: All values are stored in Registry at this location (see image)

image

As evident from the figure – all relevant values are stored here and can be retrieved (readOnly) like this:

class Program
{
static void Main(string[] args)
{
string serviceName = "FIMService"; //servicename (NOT display Name)

RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(string.Format(@"SYSTEM\CurrentControlSet\Services\{0}", serviceName));

string display = registryKey.GetValue("DisplayName") as string;
string exePath = registryKey.GetValue("ImagePath") as string;
string accountName = registryKey.GetValue("ObjectName") as string;

Console.WriteLine(display ?? "<not found>");
Console.WriteLine(exePath ?? "<not found>");
Console.WriteLine(accountName ?? "<not found>");

Console.Read();
}
}

InRiver: Not loading your extensions?

(You really need to in the loop to appreciate the issue this post addresses). Man, I've been fighting this problem for hours before I ...