Screencast: Your first state machine workflow

by Matt Milner 23. September 2008 11:00

In the latest screencast in the ongoing series, I cover the basics of creating a state machine workflow. I show you the various activities to use, how to transition between states and handle events including time based events. 

Screencast: Creating Your First State Machine Workflow


First state machine workflow


Previous screencasts in the series:


RSS feed for all screencast posts


Windows Workflow Foundation

Screeencast: Your first sequential workflow

by Matt Milner 23. September 2008 10:11

As Aaron pointed out a while back, Pluralsight has joined up with the WCF / WF folks at Microsoft to create a series of screencasts to give developers an introduction to these technologies.  My first contribution to this effort is all about creating a your first sequential workflow.  The screencasts shows the basics of creating the workflow, adding activities from the framework and custom activities. 

 First sequential workflow

RSS feed for all WF screencasts


Windows Workflow Foundation

WF and WCF resources

by Matt Milner 15. September 2008 02:09

I just found out about a few new resources that Microsoft has put together to help developers locate relevant information for developing applications using WF and WCF. This includes some of the screencasts that Aaron and I have been doing on those technologies.  It is nice to have this information in one place and provides a great jumping off point for people wanting to learn about these great technologies. (the home of our screencasts and other podcasts) -


WF on the MSDN Social Server


WCF on the MSDN Social Server -


In addition, we are Pluralsight attempt to keep our resource pages for this stuff up to date with articles books etc. on our Wiki.  The links to those

Pluralsight's WCF wiki -

Pluralsight's WF wiki -


Windows Workflow Foundation | Windows Communication Foundation

Code and slides from MDC '08

by Matt Milner 12. September 2008 17:23

I had a great time this week presenting two sessions at the Minnesota Developers Conference. For those of you who attended, I've posted the materials from my talk on LINQ as well as the materials for the ADO.NET Data Services talk.  I hope you enjoyed the show as much as I did!  You can get the slides and / or the demo code


General Musings

First BizTalk Double Feature

by Matt Milner 12. September 2008 17:19

I'm excited to be teaching the first BizTalk double feature class coming up October in Irvine.  Now I know what you are thinking: "of course you are happy to get out of Minnesota and go to sunny California", but I actually like fall in MN. No , this class is going to be cool because it allows me to cover all of BizTalk Server 2006 R2.  A normal class just doesn't give me the time to cover the core BizTalk messaging engine, orchestration, rules, etc. AND RFID, EDI, and WCF adapters.  So having the double feature is great because students new to BizTalk development will get the whole package in one week.  So if you want to learn BizTalk, come join me in CA for a very full week of BizTalk content.


BizTalk Server | General Musings

BizTalk Server 2009 and future roadmap

by Matt Milner 5. September 2008 07:07

Since the announcement of "Oslo" and the excitement around Windows WF and WCF, many customers have been concerned about their investment in BizTalk Server or questioning whether it is a wise investment today.  Microsoft just published their roadmap for BizTalk Server including some important information about how the current and future releases will integrate with the "Oslo" modeling platform.  In addition, the next release of BizTalk Server, still promised in the first half of '09, has been renamed BizTalk Server 2009 (formerly BizTalk Server 2006 R3) because of the significant improvements. 

The good news is that Microsoft has clearly stated their intent on continued investment into this product over the coming years and has some clear ideas about the types of improvements you can expect to see in future versions.

I'm most excited about platform support in the 2009 release right now as I'd like to be running only visual studio 2008 on my machines and I LOVE Windows Server 2008 so I'd like to get all my test machines upgraded to the new OS.  I'm interested to take a look at the new UDDI services and see how the directory support has been improved and can be used in a BizTalk solution as well.  The idea of a directory for services is a powerful one and not many companies realize the value of them for the simplest thing like dynamic addressing of endpoints.  All of your client applications can be built to use just a single address for the registry and lookup the endpoint information for the service. 


BizTalk Server

My first triathlon

by Matt Milner 13. July 2008 18:02

This weekend I took the plunge, literally, and participated in my first sprint triathlon here in Minneapolis.  I won't say it was pretty, or that I did excellent, but I feel pretty good about my effort and the results. Mostly I was hoping to just finish, but I did have the goal of being done in under 2 hours.  Like I said, not really looking to win any medals.  :) 

The swim went a little worse than expected with me getting doused in the face over and over with water and struggling to get into a groove with my stroke and breathing.  So I struggled for what seemed like a long time, but it ended up only being about 18 minutes which was shorter than I expected.  I then made my way to my bike and got my gear on.  I was definitely moving slow at this point but got my shoes, shirt and helmet on and thought I'd just head out.  Of course, I dropped some of my energy jelly beans and had to scoop them up, but after that the bike was good.  I finished up the 15 mile ride in about 50 minutes with no troubles at all.  The biking was never a worry for me and even though I might not be super fast, I knew I could finish and probably in reasonable time. 


My transition to the run was pretty simple as I traded my helmet for a running hat and added my running bib then headed out onto the trail.  I have a hard time estimating my pace when I'm running in a crowd so I had no idea how I was doing until I finished, but I knew it was tough to keep going and I didn't feel like I could be going a lot faster.  I finished the 3.1 mile run in about 27 minutes which is a decent 5k for me even without having swum and run beforehand. 

So my total time ended up being just under 1 hour 45 minutes which was even better than I'd hoped for.  I LOVED the experience and I'll definitely be doing another one soon.  I definitely liked it much better than doing longer distance running (a half marathon has been my longest so far) and the variety during training is definitely more interesting for me.  I've got a lot of work to do on my swimming, but I'm actually looking forward to it. 


Code Samples from todays webcast

by Matt Milner 26. June 2008 18:01

For those of you who attended my webcast today on workflow communications, the demo code is attached to this post. It includes the base activities used for communication activities (more on these in a later post) and it provides simple example of local communications and web services. The two-way communication activity and sample is also included. 

If you are interested in the webcast check here in the next day to two for the OnDemand link.







General Musings | Windows Workflow Foundation

PowerShell for BizTalk Server

by Matt Milner 26. June 2008 17:29

During my preparation for my Tech Ed talk on BizTalk Server port binding options, I wanted to write a PowerShell script to help me manage the transitions from one demo to another.  For the most part, I was looking for a way to quickly enable / disable receive locations and start / unenlist send ports and orchestrations.  All of this is available in WMI, but I wanted to make some reusable functions in PowerShell so I didn't have to drop into WMI each time I wanted to do it.  I wanted a simple function I could call like so:



It turns out that creating these functions in a script file is relatively easy.  One issue I ran into, however, is that transitions for send ports and orchestrations are not as straight forward as they are in the UI.  In the UI if a port is unenlisted, I can simply start it.  Under the covers, however, the admin tool is actually enlisting and then starting.  So, in code, I have to call the operations to both enlist and start.  Or, if the port is already enlisted, but not started, then in a function called StartSendPort, I have to just start it.  So there is some checking of the current status rather than just blindly wrapping WMI calls.  You'll need to check the docs in some situations to get the enum values.  I used the hard coded values in my case. 


function StartSendPort{

    $sp = Get-WmiObject MSBTS_SendPort -n root\MicrosoftBizTalkServer -filter "Name='$portName'"

    if($sp -ne $null)
        if($sp.Status -eq 1 -or $sp.Status -eq 2)
            if($sp.Status -eq 1)
                $null = $sp.Enlist()
            $null = $sp.Start()
            Write-Host "Started send port: " + $portName -fore Green
            Write-Host "Send port " + $portName + " is already started." -fore Yellow
        Write-Host "Send port not found" -fore Red


Where things got a little more challenging was when I wanted to start working with applications.  Applications provide a nice way to manage a group of ports by allowing start/stop functionality; unfortunately, the application is not surfaced through WMI.  Never fear however, b/c PowerShell is built on top of .NET.  All I needed to do was create an instance of the BtsCatalogExplorer class and then I was on my way to managing the applications.  But first, I had to load the assembly that included that class.  I chose to do that using the path, but strong names works very well too.  Then I used the New-Object cmdlet to create an instance and navigate to the application. 


[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft BizTalk Server 2006\Developer Tools\Microsoft.BizTalk.ExplorerOM.dll")

function StopBTSApplication

    $exp = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
    $exp.ConnectionString = Get-BTSConnectionString
    $app = $exp.Applications[$appName]
    if($app -eq $null)
        Write-Host "Application " $appName " not found" -fore Red
        if($app.Status -ne 2)
            #full stop of application
            $null = $app.Stop(63)
            $null = $exp.SaveChanges()
            Write-Host "Stopped application: " $appName



And, because I was trying not to hard code too much, I create the connection string using WMI to get the group settings. 

function Get-BTSConnectionString
    $group = Get-WmiObject MSBTS_GroupSetting -n root\MicrosoftBizTalkServer
    $dbName = $group.MgmtDBName
    $server = $group.MgmtDBServerName
    [System.String]::Concat("server=", $server, ";database=", $dbName, ";Integrated Security=SSPI")


Notice that I simply execute the Concat to get the connection string, and because this results in a new string, that value is returned to the pipeline and available to be set in a variable or used in a cmdlet. 

I'm loving the stuff I can do with PowerShell and feel like I'm just scratching the surface.  Hope this helps someone else get a jumpstart as well.  I've attached the PowerShell file with my functions included. 

Attachment: BizTalk_PowerShell.ps1.txt


BizTalk Server

Upcoming talks and webcast

by Matt Milner 9. June 2008 08:28

I've got a couple of fun talks coming up this month.  First, I'm going to be doing an MSDN webcast on Windows Workflow Foundation - Communication in Depth.  I'm going to dive into the core communication architecture, discuss how some of the OOB activities use it, and how you can build your own activities to take advantage of it.  We'll cover one way communication between the host and the workflow, but we'll also look at how to do two-way communication to get a response back from the workflow. 

The talk information can be found at this link:

Windows Workflow Communication in Depth

This talk is also part of a series where you can find other talks from my friends Jon Flanders and Jesus Rodriguez on other .NET 3.5 topics.  The link for the series is here:


I'm also doing a local talk this month at the Microsoft office if you are in the Minneapolis area.  I'll be talking about building connected systems with WF and WCF for developers and architects.  This will be a good talk if you are interested in these technologies and want to learn more about how to use them to build real applications. 

Event information and registration

I had a great time at Tech Ed and I'm looking forward to the conferences coming up this fall (Minnesota Developers Conference where I'll be doing talks on LINQ and ADO.NET Data Services and Heartland Developers Conference where I'll be talking about BizTalk Services and the "Internet Service Bus"). 


General Musings | Windows Workflow Foundation | Windows Communication Foundation