<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>NCDevGuys' ramblings on connected bits....</title><link>http://blogs.msdn.com/ncdevguy/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Getting Started : ASPX Association and Initiation Forms for SharePoint 2007 Workflows</title><link>http://blogs.msdn.com/ncdevguy/archive/2009/11/01/getting-started-aspx-association-and-initiation-forms-for-sharepoint-2007-workflows.aspx</link><pubDate>Sun, 01 Nov 2009 23:35:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915968</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/9915968.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=9915968</wfw:commentRss><description>&lt;p&gt;I realize that this topic may be somewhat of a bore for some of you out there that have already ventured down this road, but I have found that there are still many customers just now getting into SharePoint, and Workflow and then needing to create their own ASP.Net forms for association and initiation data.&lt;/p&gt;  &lt;p&gt;The hardest thing for me a lot of times is trying to figure out where to go to find the information about this, and for those who are new to the topic, where do you first begin?&lt;/p&gt;  &lt;p&gt;Luckily, SharePoint 2007 has been out for a while and the world is now looking toward SharePoint 2010 but, let’s not forget the mass of humanity that may not move there for a while…or those that will be moving eventually, but that need to get started right now with their workflows.&lt;/p&gt;  &lt;p&gt;I have put together a short list of links that have really helped me out a lot getting started understanding the mechanics of creating these form types and their integration with SharePoint 2007 workflows.&lt;/p&gt;  &lt;p&gt;First, you can start with a few articles on MSDN:    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;How to: Implement a SharePoint Workflow with ASP.NET Forms&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd206915.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd206915.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Workflow Forms Overview&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms457061.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms457061.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Creating an Application Page in WSS 3.0&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/bb418732.aspx" href="http://msdn.microsoft.com/en-us/library/bb418732.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb418732.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Those articles begin to build a lot of information in your mind about the things you will need to do to your page.&amp;#160; However, the best step-by-step guide I’ve seen is at Robert Shelton’s blog:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://rshelton.com/archive/2007/10/05/sharepoint-document-workflow-with-visual-studio-workshop-documents-download.aspx"&gt;http://rshelton.com/archive/2007/10/05/sharepoint-document-workflow-with-visual-studio-workshop-documents-download.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Robert actually has an entire series of articles on SharePoint tutorials here that are very good.&lt;/p&gt;  &lt;p&gt;As I went through this document, I stumbled upon something else quite interested.&amp;#160; As you are going through Roberts tutorial you might notice that there is code in there (such as for page-to-workflow serialization etc) that would be pretty common code for just about any type of ASP.Net form.&amp;#160; I then discovered Serge Lucas’ submission to CodePlex titled ‘&lt;strong&gt;Generic Framework for SharePoint Workflow aspx forms&lt;/strong&gt;’ at &lt;a title="http://aspxsharepointwf.codeplex.com/" href="http://aspxsharepointwf.codeplex.com/"&gt;http://aspxsharepointwf.codeplex.com/&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;On this site, you will find sample code, the framework and a link to a screencast that demonstrates how to use the framework.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915968" width="1" height="1"&gt;</description></item><item><title>InfoPath : Retrieve and Send Data from/to a SharePoint 2007 Workflow</title><link>http://blogs.msdn.com/ncdevguy/archive/2009/10/31/infopath-retrieve-and-send-data-from-to-a-sharepoint-2007-workflow.aspx</link><pubDate>Sat, 31 Oct 2009 19:13:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915702</guid><dc:creator>larrywa</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/9915702.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=9915702</wfw:commentRss><description>&lt;p&gt;Yes, I know this title sounds a bit odd, and the real title should be ‘When you are using an InfoPath task edit form, how do you use InfoPath data connection bindings to both retrieve and send data to a SharePoint 2007 workflow?’&lt;/p&gt;  &lt;p&gt;So one day I was building an InfoPath 2007 task edit form and I wanted to send data to this form from inside of my workflow by using something like:    &lt;br /&gt;    &lt;br /&gt;taskProperties.ExtendedProperties[“txtProductDescription”] = “Product ABC”;&lt;/p&gt;  &lt;p&gt;I implemented an ItemMetadata.xml file with an ‘ows_txtProductDescription’ field, added a secondary data connection for it in my InfoPath form and followed all the normal steps and when I opened the form when my task was created, the data was there as expected.&lt;/p&gt;  &lt;p&gt;However, what I didn’t realize was that when I closed the form and completed the task and then re-opened the form just to look at my previous settings, the data was gone!&amp;#160; The form appeared as if it were a new form with default settings.&amp;#160; To make matters worse, inside of the workflow I discovered that I could not use the task After properties to get the data out of the txtProductDescription field, it was always null.&amp;#160; And this is where my multi-day odyssey of searching for the answer began.&lt;/p&gt;  &lt;p&gt;To make things simple here, I’m just going to start with a simple form that has no binding and show you how to set things up.&amp;#160; I hate to admit it took me several days and talking to several people to figure this out, so I hope it helps you shorten your path to a solution also.&lt;/p&gt;  &lt;p&gt;Technologies Used:&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Microsoft Office SharePoint Server 2007 Enterprise Edition, SP1 &lt;/li&gt;    &lt;li&gt;InfoPath 2007 – Browser enabled forms &lt;/li&gt;    &lt;li&gt;Visual Studio 2008 SP1 / C# &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To begin with, here is my simple form entitled OrderRequestTask.xsn&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_1.png" width="363" height="236" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I have three InfoPath controls here here, a Textbox named ‘txtProductDescription’, a Drop-Down List named ‘drpStatus’ and a button for submitting the data.&amp;#160;&amp;#160; This is a browser enabled form.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Create the ItemMetadata.xml file&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Before we create our data connections we will need to create the ItemMetadata.xml file.&amp;#160; This is what the file will look like:    &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_3.png" width="244" height="89" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Note the ‘&lt;strong&gt;ows_&lt;/strong&gt;’ in front of the field names.&amp;#160; This is a required prefix. Make sure you save this file as an XML file.&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Setting Up the Data Connections&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I will be using two data connections:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;u&gt;Update&lt;/u&gt;&lt;/strong&gt; – this is a data connection that is used to submit the control(s) data into the workflow.&amp;#160; Follow these steps to setup this data connection:       &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;1.&amp;#160; On the Design Task link (the Design Tasks toolbox should be on the right hand side of the form in InfoPath), select &lt;strong&gt;Data Source&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;2. Select the &lt;strong&gt;Manage Data Connections&lt;/strong&gt;… link.&lt;/p&gt;    &lt;p&gt;3.&amp;#160; In the Data Connections dialog box, select &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;4.&amp;#160; Select the &lt;strong&gt;Create a New Connection to&lt;/strong&gt; and then &lt;strong&gt;Submit Data&lt;/strong&gt; radio button.&lt;/p&gt;    &lt;p&gt;5.&amp;#160; Select Next.&lt;/p&gt;    &lt;p&gt;6.&amp;#160; Select &lt;strong&gt;‘To the hosting environment, such as an ASP.Net page or a hosting application’&lt;/strong&gt; radio button.&amp;#160; Basically at this point, InfoPath has no idea we are dealing with SharePoint, what we are saying is that we are going to submit the data back to whatever host opened the form, which will be the SharePoint task list.&lt;/p&gt;    &lt;p&gt;7.&amp;#160; Change the name of the data connection from Submit to &lt;strong&gt;Update&lt;/strong&gt; and select &lt;strong&gt;Finish&lt;/strong&gt;.&amp;#160; This will complete your ‘main’ data connection.&amp;#160; You can only have one main data connection and this is the only connection that can submit data to a form or other entity.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;u&gt;ItemMetadata&lt;/u&gt;&lt;/strong&gt; – this data connection will read from an XML file named ItemMetadata.xml that will contain a reference to the controls on the form that can receive data from the workflow.&amp;#160; It is very important here that you name this xml file EXACTLY ItemMetadata.xml, spelling is important, case is important, format is important….if any of these are incorrect, the data connection will not work.&amp;#160; Another point, each form (whatever type of form it may be) that is receiving data from the workflow will have it’s own ItemMetadata.xml file, named ItemMetadata.xml so what I do is I have a separate directory for each form setup.&amp;#160; Now technically, you could have a single ItemMetadata.xml file with several fields and only use the ones you need but that could get a bit confusing down the road.&lt;/p&gt;    &lt;p&gt;8.&amp;#160; The Data Connection dialog box should already be open, if not, select Manage Data Connections again to open it up.&lt;/p&gt;    &lt;p&gt;9.&amp;#160; In the Data Connections dialog box, select &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;10.&amp;#160; Select the &lt;strong&gt;Create a New Connection to&lt;/strong&gt; and then &lt;strong&gt;Receive Data&lt;/strong&gt; radio button.&lt;/p&gt;    &lt;p&gt;11.&amp;#160; Select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;12.&amp;#160; Select ‘&lt;strong&gt;XML Document&lt;/strong&gt;’.&lt;/p&gt;    &lt;p&gt;13.&amp;#160; Select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;14.&amp;#160; Browse to where your ItemMetadata.xml file is and select it.&lt;/p&gt;    &lt;p&gt;15.&amp;#160; Select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;    &lt;p&gt;16.&amp;#160; Make sure the ‘&lt;strong&gt;Include the data as a resource file in the form template or template part&lt;/strong&gt;’ radio button is selected.&amp;#160; What this means is that the ItemMetadata.xml file is actually going to become a part of the InfoPath form itself.&amp;#160; Therefore, if you were to move this file after you get your form published, it would not matter.&amp;#160; If you ever update your ItemMetadata.xml file you will also need to go through the steps above to refresh your data connection anyway.&lt;/p&gt;    &lt;p&gt;17.&amp;#160; Select &lt;strong&gt;Next&lt;/strong&gt; then &lt;strong&gt;Finish&lt;/strong&gt;.&amp;#160; Now your Data Connections dialog box should look like this:       &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_2.png" width="345" height="342" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Binding the Controls to the Data Connections&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As it stands right now, the way I did the drag and drop of the fields onto the form and setup my main data connection, made it so that both of these fields will submit their data into the workflow without any other modification from me.&amp;#160; However, I want to be able to both receive data from the workflow AND submit the data to a workflow.&amp;#160;&amp;#160; This is where I spent so much time trying to figure out essentially, how to bind the controls to both data sources.&lt;/p&gt;  &lt;p&gt;If you right click on the &lt;strong&gt;txtProductDescription&lt;/strong&gt; field and select ‘&lt;strong&gt;Change Binding’&lt;/strong&gt; you will see the following dialog box:     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_4.png" width="402" height="325" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can see here that this field is data bound to the Main data source.&amp;#160; You could of course choose the data source dropdown and then choose the ItemMetadata (secondary) data source but then the control will only receive data from the workflow and will not submit data to the workflow.&amp;#160; Perplexing right?&lt;/p&gt;  &lt;p&gt;To correct this situation, do the following:    &lt;br /&gt;    &lt;br /&gt;1.&amp;#160; Make sure the Text Box Binding dialog box above is closed.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; With the &lt;strong&gt;txtProductDescription&lt;/strong&gt; box still selected, move over to the &lt;strong&gt;Design Tasks&lt;/strong&gt; toolbox and make sure the Data Connections window is open like below:     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_5.png" width="303" height="308" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;3.&amp;#160; Right-click on &lt;strong&gt;txtProductDescription&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;4.&amp;#160; Select &lt;strong&gt;Properties&lt;/strong&gt;:     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_6.png" width="178" height="558" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;5.&amp;#160; In the &lt;strong&gt;Field or Group Properties&lt;/strong&gt; dialog box, select the &lt;strong&gt;Fx &lt;/strong&gt;(function) button:     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_7.png" width="395" height="279" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;6.&amp;#160; In the &lt;strong&gt;Insert Formula&lt;/strong&gt; dialog box, select the &lt;strong&gt;Insert Field or Group&lt;/strong&gt; button:     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_9.png" width="393" height="252" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;7.&amp;#160; From the &lt;strong&gt;Select Field or Group&lt;/strong&gt; dialog box, select the &lt;strong&gt;Data Source&lt;/strong&gt; drop-down and select &lt;strong&gt;ItemMetadata (Secondary)&lt;/strong&gt; menu item.     &lt;br /&gt;    &lt;br /&gt;8.&amp;#160; Select the&lt;strong&gt; ows_txtProductDescription&lt;/strong&gt; field and then select &lt;strong&gt;OK&lt;/strong&gt;.&amp;#160; &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_30.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_14.png" width="312" height="361" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;9.&amp;#160; Select &lt;strong&gt;OK&lt;/strong&gt; in the Insert Formula field and then &lt;strong&gt;OK&lt;/strong&gt; and the Field or Group Properties dialog box.&lt;/p&gt;  &lt;p&gt;10.&amp;#160; Repeat steps 2 – 9, except choose the drpStatus drop-down field in the form.&amp;#160; Note that if you don’t want or need to set this value from the workflow, you can just leave the binding as is.&lt;/p&gt;  &lt;p&gt;11. Now you can save and publish your form.&amp;#160; Since this is a task edit form and the workflow is going to determine where/how to pickup this file via it’s configuration files (feature.xml and workflow.xml), we will be publishing this form to a network location.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Publishing the Form&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;1.&amp;#160; Select the &lt;strong&gt;File –&amp;gt; Publish&lt;/strong&gt; menu item.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Select ‘&lt;strong&gt;To a network location&lt;/strong&gt;’ then &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_12.png" width="362" height="147" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3.&amp;#160; Browse to where you want to publish the file and select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;4.&amp;#160; On the this page, make absolutely sure you clear out the text field in this window.&amp;#160; If you do not, SharePoint will more than likely not let anyone open the form due to permissions.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_28.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/InfoPathRetrieveandSendDatafromtoaShareP_9CAB/image_thumb_13.png" width="363" height="161" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;5.&amp;#160; Select Next.&amp;#160; You will see a dialog box warning you of possible user access problems. Just select OK.&lt;/p&gt;  &lt;p&gt;6.&amp;#160; Select &lt;strong&gt;Publish&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;7.&amp;#160; Select &lt;strong&gt;Close&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;At this point, I will defer to the experience of the student at to where they put the form so that the workflow can access it.&amp;#160; More than likely you will have a sub-directory under your workflow projects feature directory to put the form in.&amp;#160; You will then need to re-deploy your workflow project.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;What about the code in the workflow itself?&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Inside of the workflow in my CreateTask handler, I will have code that looks like this: &lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;this&lt;/span&gt;.taskProperties.ExtendedProperties[&lt;span class="str"&gt;&amp;quot;ows_txtProductDescription&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;this&lt;/span&gt;.productDescription;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;this&lt;/span&gt;.taskProperties.ExtendedProperties[&lt;span class="str"&gt;&amp;quot;ows_drpStatus&amp;quot;&lt;/span&gt;] = &lt;span class="str"&gt;&amp;quot;Completed&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;In my OnTaskChanged handler, I would have code that looks something like this: &lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; strProdDesc = &lt;span class="kwrd"&gt;this&lt;/span&gt;.taskAfterProperties.ExtendedProperties[&lt;span class="str"&gt;&amp;quot;txtProductDescription&amp;quot;&lt;/span&gt;].ToString();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;bool&lt;/span&gt; statusComplete = &lt;span class="kwrd"&gt;this&lt;/span&gt;.taskAfterProperties.ExtendedProperties.ContainsValue(&lt;span class="str"&gt;&amp;quot;Completed&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;A couple of things to note in the OnTaskChanged event is that I do not include the ‘ows_’ prefix in the field name and I am able to use ‘ContainsValue’ to get to the boolean status value.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;In conclusion, I hope this helps someone out there prevent the time loss I had when attempting to figure this out.&amp;#160; And as I’ve said before, if you know a better way of doing it, let me know!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915702" width="1" height="1"&gt;</description></item><item><title>Working with the Workflow Foundation (3.5) Delay Activity (why won’t my expired workflow automatically reload?)</title><link>http://blogs.msdn.com/ncdevguy/archive/2009/10/07/working-with-the-workflow-foundation-3-5-delay-activity-why-won-t-my-expired-workflow-automatically-reload.aspx</link><pubDate>Thu, 08 Oct 2009 03:30:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9904662</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/9904662.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=9904662</wfw:commentRss><description>&lt;p&gt;I was recently working with a customer who made the statement ‘Whenever I use a delay activity in my workflow, the workflow will automatically unload itself but will only reload into memory when a particular workflow runtime host is running.&amp;#160; It was our understanding that if a workflow had been unloaded due to a delay activity, that any runtime that had the persistence service added to it would just pick up the unloaded workflow whenever the timeout expired’.&amp;#160; &lt;/p&gt;  &lt;p&gt;The answer to why this was happening was very easy but it was quite interesting to see how these workflows reacted to the runtime scenarios being used.&amp;#160; It was just interesting enough to think I would let others know in case they run into similar issues.&lt;/p&gt;  &lt;p&gt;The scenario is to have two workflow sequential libraries and three hosts for these workflows. I placed all of these projects into one Visual Studio 2008 Solution.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_3.png" width="266" height="473" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;WorkflowDelay1&lt;/strong&gt; – This project is a sequential workflow library with the following workflow:&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_2.png" width="213" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This workflow has two code activities to write out to the console the workflow instance ID and a delay activity set to 30 seconds.&amp;#160; In order to run this workflow, I have a console based host project named &lt;strong&gt;WorkflowHostDelay1&lt;/strong&gt;.&amp;#160; The code for the host is shown here (program.cs).&amp;#160; I also added a project reference to the host that points to the &lt;strong&gt;WorkflowDelay1&lt;/strong&gt; project: &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime.Hosting;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowHostDelay1&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = &lt;span class="str"&gt;&amp;quot;Initial Catalog=TrackingStore;&amp;quot;&lt;/span&gt; + &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            &lt;span class="str"&gt;&amp;quot;Data Source=.\\SQLEXPRESS; Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            &lt;span class="kwrd"&gt;using&lt;/span&gt; (WorkflowRuntime workflowRuntime = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowRuntime())&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                AutoResetEvent waitHandle = &lt;span class="kwrd"&gt;new&lt;/span&gt; AutoResetEvent(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                workflowRuntime.WorkflowCompleted += &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowCompletedEventArgs e) &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                    { &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                        waitHandle.Set(); &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                workflowRuntime.WorkflowTerminated += &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowTerminatedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                    Console.WriteLine(e.Exception.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                    waitHandle.Set();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;                workflowRuntime.AddService(&lt;span class="kwrd"&gt;new&lt;/span&gt; SqlWorkflowPersistenceService(connectionString, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 30), &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 10)));&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;                workflowRuntime.StartRuntime();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                WorkflowInstance instance = workflowRuntime.CreateWorkflow(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(WorkflowDelay1.WFDelay1));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;                instance.Start();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;                &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;                Console.Title = &lt;span class="str"&gt;&amp;quot;WorkflowDelay1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                Console.BackgroundColor = ConsoleColor.DarkGreen;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;                Console.ForegroundColor = ConsoleColor.Yellow;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;                Console.Clear();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;                Console.WriteLine();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WorkflowDelay1 host is running&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;enter&amp;gt; to exit.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;                Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;                waitHandle.WaitOne();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This host code simply adds the SQLWorkflowPersistenceService and creates/starts and instance of WorkflowDelay1.WFDelay1.&amp;#160; I’ve set the timespans for the OwnershipTimeout and LoadInterval shorter than normal just for testing.&lt;/p&gt;

&lt;p&gt;My other workflow project, &lt;strong&gt;WorkflowDelay2&lt;/strong&gt; with a workflow type of &lt;strong&gt;WFDelay2&lt;/strong&gt; is very similar to the first workflow type except with one additional code activity added.&amp;#160; This workflow has a delay activity with a timeout of 1 minute: 

  &lt;br /&gt;

  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_4.png" width="272" height="391" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The host code (&lt;strong&gt;WorkflowHostDelay2&lt;/strong&gt;) is pretty much the same as the first set of host code.&amp;#160; The only difference is the workflow type being started.&amp;#160; I added a project reference to this host to point to the &lt;strong&gt;WorkflowDelay2&lt;/strong&gt; project.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime.Hosting;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowHostDelay2&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = &lt;span class="str"&gt;&amp;quot;Initial Catalog=TrackingStore;&amp;quot;&lt;/span&gt; + &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            &lt;span class="str"&gt;&amp;quot;Data Source=.\\SQLEXPRESS; Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            &lt;span class="kwrd"&gt;using&lt;/span&gt; (WorkflowRuntime workflowRuntime = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowRuntime())&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                AutoResetEvent waitHandle = &lt;span class="kwrd"&gt;new&lt;/span&gt; AutoResetEvent(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                workflowRuntime.WorkflowCompleted += &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowCompletedEventArgs e) &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                    { &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                        waitHandle.Set(); &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                workflowRuntime.WorkflowTerminated += &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowTerminatedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                    Console.WriteLine(e.Exception.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                    waitHandle.Set();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;                workflowRuntime.AddService(&lt;span class="kwrd"&gt;new&lt;/span&gt; SqlWorkflowPersistenceService(connectionString, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 30), &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 10)));&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;                workflowRuntime.StartRuntime();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;                WorkflowInstance instance = workflowRuntime.CreateWorkflow(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(WorkflowDelay2.WFDelay2));&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                instance.Start();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;                &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;                Console.Title = &lt;span class="str"&gt;&amp;quot;WorkflowDelay2&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;                Console.BackgroundColor = ConsoleColor.DarkGreen;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                Console.ForegroundColor = ConsoleColor.Yellow;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;                Console.Clear();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;                Console.WriteLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WorkflowDelay2 host is running&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;enter&amp;gt; to exit.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;                Console.ReadLine();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;                waitHandle.WaitOne();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So how do we test how the delay activities work?&amp;#160; What I am going to do, is start up both WorkflowHostDelay1 and WorkflowHostDelay2 long enough for the workflows to start and then be unloaded into the persistence InstanceState table.&amp;#160; Once I see that the workflows are persisted, I will shut down the console based hosts which means that the workflows will timeout while sitting in the database.&lt;/p&gt;

&lt;p&gt;After I do this, taking a snapshot of the InstanceState table I see:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_5.png" width="782" height="98" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;You can see here that these workflows are not owned by anyone at this point.&lt;/p&gt;

&lt;p&gt;What I wanted to do next was start up a new instance of a workflow runtime (any runtime) with a persistence service and see what would happen with the workflows in the database.&amp;#160; I created another host project named HostWithOnlyaRuntime that looks like this: 
  &lt;br /&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime.Hosting;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; HostWithOnlyaRuntime&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = &lt;span class="str"&gt;&amp;quot;Initial Catalog=TrackingStore;&amp;quot;&lt;/span&gt; + &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            &lt;span class="str"&gt;&amp;quot;Data Source=.\\SQLEXPRESS; Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            &lt;span class="kwrd"&gt;using&lt;/span&gt; (WorkflowRuntime workflowRuntime = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowRuntime())&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                &lt;span class="rem"&gt;//AutoResetEvent waitHandle = new AutoResetEvent(false);&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                workflowRuntime.AddService(&lt;span class="kwrd"&gt;new&lt;/span&gt; SqlWorkflowPersistenceService(connectionString, &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 30), &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 10)));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                workflowRuntime.StartRuntime();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                Console.Title = &lt;span class="str"&gt;&amp;quot;HostWithOnlyaRuntimeowDelay2&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                Console.BackgroundColor = ConsoleColor.White;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                Console.ForegroundColor = ConsoleColor.Black;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                Console.Clear();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                Console.WriteLine();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;HostWithOnlyaRuntimeowDelay2 host is running&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;enter&amp;gt; to exit.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;                Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;                workflowRuntime.StopRuntime();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                &lt;span class="rem"&gt;//waitHandle.WaitOne();&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This code just starts up the runtime, adds the persistence service and then starts the runtime.&amp;#160; At this point, if I look at my records in the database I see that although it appears a have a new ownerID and it is locked until a certain point in time, the workflows themselves do not actually ever reload. 
  &lt;br /&gt;

  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_6.png" width="588" height="128" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As long as I have this host running, these records will remain locked, which means no other host can start the workflows either.&lt;/p&gt;

&lt;p&gt;To prove this point, comment out the code to start up a new workflow in WorkflowHostDelay2 (we don’t need to start a new workflow this time) and then startup the host.&amp;#160; The WorkflowHostDelay2 host will sit there indefinitely and not reload the workflow it originally started.&amp;#160;&amp;#160; But wait, why would this host have to reload the same workflow that it had originally started?&lt;/p&gt;

&lt;p&gt;The answer is, it doesn’t.&amp;#160; Steve Danielson (Microsoft - &lt;a title="http://blogs.msdn.com/sdanie/" href="http://blogs.msdn.com/sdanie/"&gt;http://blogs.msdn.com/sdanie/&lt;/a&gt;) pointed out a few things.&lt;/p&gt;

&lt;p&gt;What’s going on here is that when &lt;strong&gt;HostWithOnlyaRuntime&lt;/strong&gt; starts, the SQLWorkflowPersistenceService puts a lock on these workflows because it wants to load them, but it can’t because this runtime has no reference to the workflow types &lt;strong&gt;WorkflowDelay1.WFDelay1&lt;/strong&gt; and &lt;strong&gt;WorkflowDelay2.WFDelay2&lt;/strong&gt;.&amp;#160; To allow HostWithOnlyaRuntime to reload these workflows, all I would have to do is add a project reference to the WorkflowDelay1 and WorkflowDelay2 projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WorkingwiththeWorkflowFou.5DelayActivity_10F26/image_thumb_7.png" width="579" height="193" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In my customers case, he had two different application servers but on one of the machines, he did not have a reference to one of the workflow types.&amp;#160; On this application server that was missing the workflow type reference, when the host would start, it would leave expired workflows in the database.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;I hope this helps someone who might be facing a similar scenario.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9904662" width="1" height="1"&gt;</description></item><item><title>Versioning Workflow Services</title><link>http://blogs.msdn.com/ncdevguy/archive/2009/10/06/versioning-workflow-services.aspx</link><pubDate>Wed, 07 Oct 2009 03:33:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9904051</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/9904051.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=9904051</wfw:commentRss><description>&lt;p&gt;A couple of years ago (that sounds like an eternity in computer years), I had written up an article on the versioning of workflows &lt;a href="http://blogs.msdn.com/ncdevguy/archive/2007/06/14/versioning-techniques-for-workflows.aspx"&gt;http://blogs.msdn.com/ncdevguy/archive/2007/06/14/versioning-techniques-for-workflows.aspx&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Since then, a lot of things have happened, I've been bouncing back and forth between WCF, SharePoint Workflows, WCF exposed workflows and so on. One thing I've come to discover though is that when you are talking with customers who are using the Workflow Foundation, most of them still don't have a concrete handle on how to version their workflows and especially workflows that are exposed as WCF services.&lt;/p&gt;  &lt;p&gt;So with the help of Xingang Liao of Ensemble Studios (China), we came up with a similar way of doing the versioning that we thought may help others who are still trying to figure this out. We of course are of the opinion that this may not be the best way to do this and if you see anything to make the code more efficient or an even better way to do this, let me know.&lt;/p&gt;  &lt;p&gt;We’ll start with this context:&lt;/p&gt;  &lt;p&gt;Framework Version: .Net Framework 3.5 SP1&lt;/p&gt;  &lt;p&gt;Host: Console based application that uses WorkflowServiceHost as its host. This console based approach can of course be applied to a Windows Service (NT Service) based approach.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Creating the Solution&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;1. Create a new empty workflow Visual Studio 2008 Solution named WFVersioningApp by selecting &lt;strong&gt;File | New | Project | Visual C# | Workflow | Empty Workflow Project&lt;/strong&gt; and giving it the before mentioned name.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Creating the Workflow Project&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;1.&amp;#160; Here, I created a new Sequential Workflow Library named WFProject and with a workflow (VersionWF.cs) that looks like this.&amp;#160; The objective here is to have a workflow that has two Receive activities, the first one of which will be used to start the workflow, the workflow will then be unloaded and another WCF operation will be called ( RestartWF - into the second Receive activity) to reload and start the workflow back up.&amp;#160; I also added a custom activity I wrote that would log to the Application Event log but you really could put any type of activity here that would allow you to see that indeed the correct version of the workflow has been awakened.    &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_thumb.png" width="273" height="494" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I placed a code activity inside of the first Receive activity just to hard-code a value for the event log.&amp;#160; So basically, I don’t have any real code inside of my workflow code-behind that is really important for this demonstration.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Next, I created a new file for my WCF service.&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WFProject&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    [ServiceContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IVersionWorkflow&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        [OperationContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; KickoffWF();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        [OperationContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; RestartWF();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Notice here that both these operations return void and are Request Response type of operations.&amp;#160; You will need to add a reference to System.ServiceModel to your workflow project.&lt;/p&gt;

&lt;p&gt;3.&amp;#160; Add an app.config file to the project (which will later be used in your console based host ~ I just like to have this in two places in the beginning).&amp;#160; In this app.config file you need to add a services section.&amp;#160; You’ll notice in this example that I have two services listed, I’ll explain that later in the article.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&amp;lt;system.serviceModel&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &amp;lt;services&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;            &amp;lt;service name=&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF&amp;quot;&lt;/span&gt; behaviorConfiguration=&lt;span class="str"&gt;&amp;quot;ServiceBehavior&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;                &amp;lt;endpoint address=&lt;span class="str"&gt;&amp;quot;net.tcp://localhost:8800/WFProject/VersionWF&amp;quot;&lt;/span&gt; binding=&lt;span class="str"&gt;&amp;quot;netTcpContextBinding&amp;quot;&lt;/span&gt; contract=&lt;span class="str"&gt;&amp;quot;WFProject.IVersionWorkflow&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;            &amp;lt;/service&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;      &amp;lt;service name=&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF_V2&amp;quot;&lt;/span&gt; behaviorConfiguration=&lt;span class="str"&gt;&amp;quot;ServiceBehaviorV2&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &amp;lt;endpoint address=&lt;span class="str"&gt;&amp;quot;net.tcp://localhost:8800/WFProject/VersionWFV2&amp;quot;&lt;/span&gt; binding=&lt;span class="str"&gt;&amp;quot;netTcpContextBinding&amp;quot;&lt;/span&gt; contract=&lt;span class="str"&gt;&amp;quot;WFProject.IVersionWorkflow&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;      &amp;lt;/service&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &amp;lt;/services&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        &amp;lt;behaviors&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            &amp;lt;serviceBehaviors&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;                &amp;lt;behavior name=&lt;span class="str"&gt;&amp;quot;ServiceBehavior&amp;quot;&lt;/span&gt;  &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;                    &amp;lt;serviceMetadata httpGetEnabled=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; httpGetUrl=&lt;span class="str"&gt;&amp;quot;http://localhost:8888/WFProject/VersionWF&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                    &amp;lt;serviceDebug includeExceptionDetailInFaults=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;                    &amp;lt;serviceCredentials&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                        &amp;lt;windowsAuthentication  allowAnonymousLogons=&lt;span class="str"&gt;&amp;quot;false&amp;quot;&lt;/span&gt; includeWindowsGroups=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                    &amp;lt;/serviceCredentials&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                &amp;lt;/behavior&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        &amp;lt;behavior name=&lt;span class="str"&gt;&amp;quot;ServiceBehaviorV2&amp;quot;&lt;/span&gt;  &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;          &amp;lt;serviceMetadata httpGetEnabled=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; httpGetUrl=&lt;span class="str"&gt;&amp;quot;http://localhost:8888/WFProject/VersionWFV2&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;          &amp;lt;serviceDebug includeExceptionDetailInFaults=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;          &amp;lt;serviceCredentials&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            &amp;lt;windowsAuthentication  allowAnonymousLogons=&lt;span class="str"&gt;&amp;quot;false&amp;quot;&lt;/span&gt; includeWindowsGroups=&lt;span class="str"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;          &amp;lt;/serviceCredentials&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        &amp;lt;/behavior&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        &amp;lt;/serviceBehaviors&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        &amp;lt;/behaviors&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &amp;lt;/system.serviceModel&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;A couple of things to point out in the above config file settings:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;a.&amp;#160; I am actually using a net.tcp address for the service but I’m using an http address for the clients who will be getting the service information.&amp;#160; &lt;br /&gt;b.&amp;#160; The authentication information in this example is not really relevant to our discussion here. 

    &lt;br /&gt;c.&amp;#160; I am not using a single base address, I am using relative addresses for each service configuration.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;4.&amp;#160; I created a WFProject.snk file so this assembly could be strong named and placed in the GAC, hence allowing execution side-by-side with other versions.&lt;/p&gt;

&lt;p&gt;5.&amp;#160; I confirmed that in my workflow projects Assembly.cs file that the AssemblyVersion is 1.0.0.0.&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Creating the Console Host&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;1. Create a new Console based Windows application named WorkflowHost in the same solution.&lt;/p&gt;

&lt;p&gt;2.&amp;#160; Copy the app.config file from the WFProject project into the WorkflowHost project.&lt;/p&gt;

&lt;p&gt;3.&amp;#160; Add references to the following assemblies:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_thumb_1.png" width="244" height="141" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;4.&amp;#160; Create a new class (in a new file) named WFVersionServiceHost.&amp;#160; This class will be derived from WorkflowServiceHost and will be a our base class for our service host.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Description;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime.Hosting;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowHost&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WFVersionServiceHost : WorkflowServiceHost&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ConfigurationName;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; ServiceDescription _serviceDesc;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = &lt;span class="str"&gt;&amp;quot;Initial Catalog=TrackingStore;&amp;quot;&lt;/span&gt; + &lt;span class="str"&gt;&amp;quot;Data Source=.\\SQLEXPRESS; Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; WFVersionServiceHost(Type workflowType, &lt;span class="kwrd"&gt;params&lt;/span&gt; Uri[] baseAddress)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            : &lt;span class="kwrd"&gt;base&lt;/span&gt;(workflowType, baseAddress)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            WorkflowRuntime wfRuntime = _serviceDesc.Behaviors.Find&amp;lt;WorkflowRuntimeBehavior&amp;gt;().WorkflowRuntime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            wfRuntime.WorkflowTerminated&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                           += &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowTerminatedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                           {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                               Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WorkflowTerminated: &amp;quot;&lt;/span&gt; + e.Exception.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                           };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            wfRuntime.WorkflowCompleted&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                         += &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowCompletedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;                         {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;                             Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WorkflowCompleted: &amp;quot;&lt;/span&gt; + e.WorkflowInstance.InstanceId.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                         };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            wfRuntime.WorkflowUnloaded&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;                         += &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, WorkflowEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                         {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;                             Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WorkflowUnloaded: &amp;quot;&lt;/span&gt; + e.WorkflowInstance.InstanceId.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;                         };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                       &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            wfRuntime.AddService(&lt;span class="kwrd"&gt;new&lt;/span&gt; SqlWorkflowPersistenceService(connectionString, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 30), &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 5, 0)));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;        &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; ServiceDescription CreateDescription(&lt;span class="kwrd"&gt;out&lt;/span&gt; IDictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, ContractDescription&amp;gt; implementedContracts)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;            ServiceDescription sd = &lt;span class="kwrd"&gt;base&lt;/span&gt;.CreateDescription(&lt;span class="kwrd"&gt;out&lt;/span&gt; implementedContracts);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            sd.ConfigurationName = WFVersionServiceHost.ConfigurationName;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;            _serviceDesc = sd;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; sd;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;A couple of things to note about the base class:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;a.&amp;#160; I wanted to create a custom host to make it a bit easier to capture the workflow terminated/completed etc events.&amp;#160; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;b.&amp;#160; The override to CreateDescription is used so that from our program.cs file, we can specify a new configuration name for each version of our workflow.&amp;#160; This configuration name represents the &amp;lt;service name=””&amp;gt; setting in our app.config file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;c.&amp;#160; Subscribing to the workflow runtime events need to take place in the constructor because if you put this code in the CreateDescription method, the workflow runtime has not yet been created.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;d.&amp;#160; On line 42, notice that for each version of the workflow, I add the SQLWorkflowPersistenceService.&amp;#160; As far as I know, there is no way to add this once for all hosts.&amp;#160; If you know a way, please comment!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;5.&amp;#160; Here is the program.cs file:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime.Hosting;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Description;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Reflection;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowHost&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;       &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            &lt;span class="rem"&gt;//get the 'types' related to the version of the assemblies&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            Type serviceTypeV1 = Type.GetType(&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF, WFProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=88a8d45b55e52cbf&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            Type serviceTypeV2 = Type.GetType(&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF, WFProject, Version=2.0.0.0, Culture=neutral, PublicKeyToken=88a8d45b55e52cbf&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            &lt;span class="rem"&gt;//the configuration name will match the &amp;lt;service name=&amp;quot;&amp;quot;&amp;gt; value in the &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            &lt;span class="rem"&gt;//app.config file&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            WFVersionServiceHost.ConfigurationName = &lt;span class="str"&gt;&amp;quot;WFProject.VersionWF&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            &lt;span class="rem"&gt;//create an instance of the workflow service host&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            WFVersionServiceHost wshV1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFVersionServiceHost(serviceTypeV1);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            &lt;span class="rem"&gt;//open the host&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            wshV1.Open();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            &lt;span class="rem"&gt;//notice we have to listen for both versions of the component at different&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            &lt;span class="rem"&gt;//addresses&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            WFVersionServiceHost.ConfigurationName = &lt;span class="str"&gt;&amp;quot;WFProject.VersionWF_V2&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            WFVersionServiceHost wshV2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFVersionServiceHost(serviceTypeV2);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;            wshV2.Open();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;      &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;            Console.Title = &lt;span class="str"&gt;&amp;quot;WF Version Service&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            Console.BackgroundColor = ConsoleColor.DarkGreen;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            Console.ForegroundColor = ConsoleColor.Yellow;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;            Console.Clear();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            Console.WriteLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WF Version Service is ready.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;WF Version V2 Service is ready.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;enter&amp;gt; to exit.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;            Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;            wshV1.Close();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;            wshV2.Close();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Comments:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;a.&amp;#160; Note that for each version of our workflow project, I get the type.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;b.&amp;#160; Next, set the ConfigurationName.&amp;#160; This will match the section in the app.config file for the service name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;c.&amp;#160; Create an instance of the WFVersionServiceHost, passing in the service type.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;d.&amp;#160; Open the service host.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once again, let’s look at the corresponding section in the app.config file: 
  &lt;br /&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&amp;lt;services&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &amp;lt;service name=&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF&amp;quot;&lt;/span&gt; behaviorConfiguration=&lt;span class="str"&gt;&amp;quot;ServiceBehavior&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &amp;lt;endpoint address=&lt;span class="str"&gt;&amp;quot;net.tcp://localhost:8800/WFProject/VersionWF&amp;quot;&lt;/span&gt; binding=&lt;span class="str"&gt;&amp;quot;netTcpContextBinding&amp;quot;&lt;/span&gt; contract=&lt;span class="str"&gt;&amp;quot;WFProject.IVersionWorkflow&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &amp;lt;/service&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;              &amp;lt;service name=&lt;span class="str"&gt;&amp;quot;WFProject.VersionWF_V2&amp;quot;&lt;/span&gt; behaviorConfiguration=&lt;span class="str"&gt;&amp;quot;ServiceBehaviorV2&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &amp;lt;endpoint address=&lt;span class="str"&gt;&amp;quot;net.tcp://localhost:8800/WFProject/VersionWFV2&amp;quot;&lt;/span&gt; binding=&lt;span class="str"&gt;&amp;quot;netTcpContextBinding&amp;quot;&lt;/span&gt; contract=&lt;span class="str"&gt;&amp;quot;WFProject.IVersionWorkflow&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;      &amp;lt;/service&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;lt;/services&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Notice how the service names match up with the ConfigurationName on lines 24 and 32 in the program.cs file.&amp;#160; They are both still using the same WCF service contract and the same workflow class name.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Create the Client Application&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;1.&amp;#160; For this, I created a new WinForm application named WFVersioningApp and added it to the solution.&amp;#160; The form looks like this: 
  &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/VersioningWorkflowServices_F965/image_thumb_2.png" width="434" height="409" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;What happens with this form is that I will associate a customers name with my unique workflow InstanceId.&amp;#160; The WF Version field is just for me to use inside of my winform code to determine which proxy I want to use to reload the workflows.&amp;#160;&amp;#160; The Endpoint Addr field is used at the endpoint address for the proxy I am using.&amp;#160; We will have a different net.tcp endpoint address for each version of our workflow.&lt;/p&gt;

&lt;p&gt;2.&amp;#160; The Winform code looks like this: 
  &lt;br /&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ComponentModel;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Data;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Drawing;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Forms;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Channels;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Workflow.Runtime;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Data.SqlClient;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; WFVersioningApp.WFReference;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; WFVersioningApp.WFReferenceV2;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WFVersioningApp&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WFForm : Form&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="rem"&gt;//Customer myCust;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        &lt;span class="rem"&gt;//proxy type located in reference.cs&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        WFReference.VersionWorkflowClient proxy_v1;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        WFReferenceV2.VersionWorkflowClient proxy_v2;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        WFReference.VersionWorkflowClient proxy2_v1;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        WFReferenceV2.VersionWorkflowClient proxy2_v2;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        IDictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; basicContext;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _wfInstId = &lt;span class="kwrd"&gt;default&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _epAddress = &lt;span class="kwrd"&gt;default&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; WFForm()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            InitializeComponent();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; WFForm_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            &lt;span class="rem"&gt;// TODO: This line of code loads data into the 'trackingStoreDataSet1.tblVersion' table. You can move, or remove it, as needed.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.tblVersionTableAdapter.Fill(&lt;span class="kwrd"&gt;this&lt;/span&gt;.trackingStoreDataSet1.tblVersion);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnStartNewWF_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;            IContextManager contextManager = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            _epAddress = &lt;span class="kwrd"&gt;this&lt;/span&gt;.txtEndpoint.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.txtVersion.Text == &lt;span class="str"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;                proxy_v1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFReference.VersionWorkflowClient();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;                contextManager = proxy_v1.InnerChannel.GetProperty&amp;lt;IContextManager&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;                proxy_v1.KickoffWF();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;                proxy_v1.Close();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;                proxy_v2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFReferenceV2.VersionWorkflowClient();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;                contextManager = proxy_v2.InnerChannel.GetProperty&amp;lt;IContextManager&amp;gt;();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;                proxy_v2.KickoffWF();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;                proxy_v2.Close();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            &lt;span class="rem"&gt;// This comes back as an instantiated object, but has 0 elements in it&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            basicContext = contextManager.GetContext();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;            _wfInstId = contextManager.GetContext()[&lt;span class="str"&gt;&amp;quot;instanceId&amp;quot;&lt;/span&gt;];&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;            AddCustomerToDatabase();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnRestartWF_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; _wfId = &lt;span class="kwrd"&gt;default&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; _wfVersion = &lt;span class="kwrd"&gt;default&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;            IContextManager contextManager = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;            Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; _myDict = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;            &lt;span class="preproc"&gt;#region&lt;/span&gt; DataGrid Logic&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;            DataGridViewSelectedRowCollection rows = dataGridView1.SelectedRows;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (rows.Count &amp;gt; 1)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;                MessageBox.Show(&lt;span class="str"&gt;&amp;quot;You can only select one item&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt;(rows.Count &amp;lt; 1)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;                MessageBox.Show(&lt;span class="str"&gt;&amp;quot;You must select at least one row in the grid&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  97:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  98:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  99:  &lt;/span&gt;            &lt;span class="rem"&gt;//get the value from the workflow id column&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 100:  &lt;/span&gt;            _wfId = rows[0].Cells[1].Value.ToString();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 101:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 102:  &lt;/span&gt;            &lt;span class="rem"&gt;//get the version number&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 103:  &lt;/span&gt;            _wfVersion = rows[0].Cells[2].Value.ToString();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 104:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 105:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (_wfId.Length &amp;lt;= 0)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 106:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 107:  &lt;/span&gt;                MessageBox.Show(&lt;span class="str"&gt;&amp;quot;Invalid workflow instance ID&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 108:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 109:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 110:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 111:  &lt;/span&gt;            &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 112:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 113:  &lt;/span&gt;            _myDict.Add(&lt;span class="str"&gt;&amp;quot;instanceId&amp;quot;&lt;/span&gt;, _wfId);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 114:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 115:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 116:  &lt;/span&gt;            &lt;span class="kwrd"&gt;switch&lt;/span&gt; (_wfVersion)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 117:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 118:  &lt;/span&gt;                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 119:  &lt;/span&gt;                    proxy2_v1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFReference.VersionWorkflowClient();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 120:  &lt;/span&gt;                    contextManager = proxy2_v1.InnerChannel.GetProperty&amp;lt;IContextManager&amp;gt;();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 121:  &lt;/span&gt;                    contextManager.SetContext(_myDict);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 122:  &lt;/span&gt;                    proxy2_v1.RestartWF();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 123:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 124:  &lt;/span&gt;                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;2&amp;quot;&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 125:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 126:  &lt;/span&gt;                    proxy2_v2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; WFReferenceV2.VersionWorkflowClient();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 127:  &lt;/span&gt;                    contextManager = proxy2_v2.InnerChannel.GetProperty&amp;lt;IContextManager&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 128:  &lt;/span&gt;                    contextManager.SetContext(_myDict);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 129:  &lt;/span&gt;                    proxy2_v2.RestartWF();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 130:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 131:  &lt;/span&gt;                &lt;span class="kwrd"&gt;default&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 132:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 133:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 134:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 135:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 136:  &lt;/span&gt;            &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 137:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 138:  &lt;/span&gt;                &lt;span class="rem"&gt;//the workflow has already been deleted but we need to delete our own records&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 139:  &lt;/span&gt;                DeleteCustomerFromDatabase(_wfId);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 140:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 141:  &lt;/span&gt;            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (System.Exception ex)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 142:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 143:  &lt;/span&gt;                MessageBox.Show(&lt;span class="str"&gt;&amp;quot;Exception during workflow restart: &amp;quot;&lt;/span&gt; + ex.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 144:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 145:  &lt;/span&gt;            &lt;span class="kwrd"&gt;finally&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 146:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 147:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 148:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (proxy2_v1 != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 149:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 150:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (proxy2_v1.State == CommunicationState.Opened)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 151:  &lt;/span&gt;                    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 152:  &lt;/span&gt;                        proxy2_v1.Close();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 153:  &lt;/span&gt;                    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 154:  &lt;/span&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 155:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 156:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (proxy2_v2 != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 157:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 158:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (proxy2_v2.State == CommunicationState.Opened)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 159:  &lt;/span&gt;                    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 160:  &lt;/span&gt;                        proxy2_v2.Close();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 161:  &lt;/span&gt;                    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 162:  &lt;/span&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 163:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 164:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 165:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 166:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 167:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnClose_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 168:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 169:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.Close();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 170:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 171:  &lt;/span&gt;        &lt;span class="preproc"&gt;#region&lt;/span&gt; Database methods&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 172:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddCustomerToDatabase()&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 173:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 174:  &lt;/span&gt;            SqlCommand cmd = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlCommand();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 175:  &lt;/span&gt;            cmd.CommandType = CommandType.StoredProcedure;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 176:  &lt;/span&gt;            cmd.CommandText = &lt;span class="str"&gt;&amp;quot;dbo.InsertCustomer&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 177:  &lt;/span&gt;            cmd.Connection = &lt;span class="kwrd"&gt;this&lt;/span&gt;.tblVersionTableAdapter.Connection;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 178:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 179:  &lt;/span&gt;            &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 180:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 181:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (cmd.Connection.State != ConnectionState.Open)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 182:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 183:  &lt;/span&gt;                    cmd.Connection.Open();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 184:  &lt;/span&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 185:  &lt;/span&gt;                &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 186:  &lt;/span&gt;                cmd.Parameters.AddWithValue(&lt;span class="str"&gt;&amp;quot;@CustomerName&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;this&lt;/span&gt;.txtCustomerName.Text);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 187:  &lt;/span&gt;                cmd.Parameters.AddWithValue(&lt;span class="str"&gt;&amp;quot;@WFId&amp;quot;&lt;/span&gt;, _wfInstId);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 188:  &lt;/span&gt;                cmd.Parameters.AddWithValue(&lt;span class="str"&gt;&amp;quot;@Version&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;this&lt;/span&gt;.txtVersion.Text);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 189:  &lt;/span&gt;                cmd.Parameters.AddWithValue(&lt;span class="str"&gt;&amp;quot;@EndpointAddr&amp;quot;&lt;/span&gt;, _epAddress);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 190:  &lt;/span&gt;                &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 191:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 192:  &lt;/span&gt;                cmd.CommandType = CommandType.StoredProcedure;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 193:  &lt;/span&gt;                cmd.ExecuteNonQuery();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 194:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 195:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 196:  &lt;/span&gt;            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 197:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 198:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;InsertCustomerName error :{0}&amp;quot;&lt;/span&gt;, ex.Message);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 199:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 200:  &lt;/span&gt;            &lt;span class="kwrd"&gt;finally&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 201:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 202:  &lt;/span&gt;                cmd.Connection.Close();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 203:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 204:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 205:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.dataGridView1.DataSource = &lt;span class="kwrd"&gt;this&lt;/span&gt;.tblVersionTableAdapter.GetData();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 206:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 207:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 208:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 209:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DeleteCustomerFromDatabase(&lt;span class="kwrd"&gt;string&lt;/span&gt; wfInstId)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 210:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 211:  &lt;/span&gt;            &lt;span class="rem"&gt;//when the workflow has completed, remove it from the database&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 212:  &lt;/span&gt;            SqlCommand cmd = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlCommand();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 213:  &lt;/span&gt;            cmd.CommandType = CommandType.StoredProcedure;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 214:  &lt;/span&gt;            cmd.CommandText = &lt;span class="str"&gt;&amp;quot;dbo.DeleteCustomerWorkflow&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 215:  &lt;/span&gt;            cmd.Connection = &lt;span class="kwrd"&gt;this&lt;/span&gt;.tblVersionTableAdapter.Connection;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 216:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 217:  &lt;/span&gt;            &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 218:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 219:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (cmd.Connection.State != ConnectionState.Open)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 220:  &lt;/span&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 221:  &lt;/span&gt;                    cmd.Connection.Open();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 222:  &lt;/span&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 223:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 224:  &lt;/span&gt;                cmd.Parameters.AddWithValue(&lt;span class="str"&gt;&amp;quot;@WFId&amp;quot;&lt;/span&gt;, wfInstId);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 225:  &lt;/span&gt;                cmd.CommandType = CommandType.StoredProcedure;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 226:  &lt;/span&gt;                cmd.ExecuteNonQuery();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 227:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 228:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 229:  &lt;/span&gt;            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 230:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 231:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;DeleteCustomerWorkflow error :{0}&amp;quot;&lt;/span&gt;, ex.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 232:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 233:  &lt;/span&gt;            &lt;span class="kwrd"&gt;finally&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 234:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 235:  &lt;/span&gt;                cmd.Connection.Close();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 236:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 237:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 238:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.dataGridView1.DataSource = &lt;span class="kwrd"&gt;this&lt;/span&gt;.tblVersionTableAdapter.GetData();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 239:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 240:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 241:  &lt;/span&gt;        &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 242:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 243:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 244:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 245:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;There is certainly a lot of code here, none of which is terribly complex (or production ready!) but I’ll explain what I consider to be the important pieces: 
    &lt;br /&gt;

    &lt;br /&gt;a.&amp;#160; Lines 24 – 27.&amp;#160; I wanted to make sure here that I was truly using different proxy instances whenever I call back into the workflow.&amp;#160; You will have to add two different service references to the project, one for each endpoint (remember to use the http addresses from the WorkflowHost projects app.config file to find the service metadata).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;b.&amp;#160; Lines 52 through 58.&amp;#160; Whenever I want to create a version 1 workflow, I need to create an proxy to the first endpoints client and then from that, I get the ContextManager (which will be empty at this point).&amp;#160; When I call KickoffWF, the context will be filled with the instance id of the workflow returned by the first Receive activity.&amp;#160; Note that in real life, you are not typically going to have code that allows people to keep creating versions of workflow version 1.0.0.0.&amp;#160; Imagine that this is the code that your client app started with and then as you added new versions of your workflow, you would have to add such code as you see here to at minimum be able to restart version 1.0.0.0 of the workflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;c.&amp;#160; Lines 70 and 71, this is where we get the workflow instance ID out of the context.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;d.&amp;#160; Line 73, call the AddCustomerToDatabase method.&amp;#160; I have added a tblVersion table to the TrackingStore database along with a few stored procs to handle adding and deleting the customer name and corresponding workflow instance id information. (I’ll show the SQL script down below)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;e.&amp;#160; Line 113.&amp;#160; In the btnRestartWF_Click method, I grab the workflow instance ID out of the grid and fill in a string dictionary to be used to set my context for the next Receive activity call.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;f.&amp;#160; Line 119 – 122.&amp;#160; Create a new proxy instance.&amp;#160; The only difference in this code and the code that initially kicked the workflow off is that here (line 121) I ‘set’ the context value to be the instance id of the workflow to reload.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Testing the Workflow Versions&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;1.&amp;#160; In order to test this, what I did was I wrote out strings in my logging activity that specifically said ‘v1’.&amp;#160; I then built the component and deployed it to the GAC.&amp;#160;&amp;#160; I ran through my client and created a v1 workflow.&lt;/p&gt;

&lt;p&gt;2.&amp;#160; I then went and changed the strings for the logging activity to ‘v2’ and updated the Assembly.cs file to 2.0.0.0. and redeployed to the GAC.&lt;/p&gt;

&lt;p&gt;3.&amp;#160; I ran the client and created a few workflows that were version 2.0.&amp;#160; &lt;/p&gt;

&lt;p&gt;4.&amp;#160; I then, selected a version 1.0 workflow from the grid and restarted that workflow.&amp;#160; I was able to look in my Application event viewer and see that ‘v1’ had been restarted.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;The SQL Script&lt;/font&gt;&lt;/strong&gt; – I put this code in with my TrackingStore database (persistence and tracking database)&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;USE [TrackingStore]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;/****** Object:  Table [dbo].[tblVersion]    Script Date: 09/29/2009 19:35:36 ******/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;SET ANSI_NULLS ON&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;SET QUOTED_IDENTIFIER ON&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;CREATE TABLE [dbo].[tblVersion](&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    [CustomerName] [nvarchar](50) NOT NULL,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    [WorkflowID] [uniqueidentifier] NOT NULL,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    [WorkflowVersion] [smallint] NULL,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    [EndpointAddress] [nvarchar](50) NULL,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt; CONSTRAINT [PK_tblVersion] PRIMARY KEY CLUSTERED &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;(&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    [WorkflowID] ASC&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;) ON [PRIMARY]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&lt;span class="rem"&gt;/****** Object:  StoredProcedure [dbo].[DeleteCustomerWorkflow]    Script Date: 09/29/2009 19:36:26 ******/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;SET ANSI_NULLS ON&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;SET QUOTED_IDENTIFIER ON&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;-- =============================================&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;-- Author:        &amp;lt;Author,,Name&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;-- Create date: &amp;lt;Create Date,,&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;-- Description:    &amp;lt;Description,,&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;-- =============================================&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;CREATE PROCEDURE [dbo].[DeleteCustomerWorkflow] @WFId uniqueidentifier &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;AS&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;BEGIN&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    DELETE FROM [dbo].[tblVersion] WHERE WorkflowID=@WFId&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;END&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&lt;span class="rem"&gt;/****** Object:  StoredProcedure [dbo].[InsertCustomer]    Script Date: 09/29/2009 19:37:06 ******/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;SET ANSI_NULLS ON&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;SET QUOTED_IDENTIFIER ON&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;GO&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;-- =============================================&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;-- Author:        &amp;lt;Author,,Name&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;-- Create date: &amp;lt;Create Date,,&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;-- Description:    &amp;lt;Description,,&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;-- =============================================&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;CREATE PROCEDURE [dbo].[InsertCustomer] @CustomerName nvarchar(50),&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;@WFId uniqueidentifier,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;@Version smallint,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;@EndpointAddr nvarchar(50)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;AS&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;BEGIN&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;    -- SET NOCOUNT ON added to prevent extra result sets from&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    -- interfering with SELECT statements.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    SET NOCOUNT ON;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;    SET TRANSACTION ISOLATION LEVEL READ COMMITTED&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;        &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;    declare @localized_string_InsertCustomer_Failed_GetType nvarchar(256)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;    set @localized_string_InsertCustomer_Failed_GetType = N&lt;span class="str"&gt;'GetTypeId failed'&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;    declare @localized_string_InsertCustomer_InsertFailed nvarchar(256)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;    set @localized_string_InsertCustomer_InsertFailed = N&lt;span class="str"&gt;'Failed inserting Customer into TrackingStore'&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;    DECLARE @local_tran        bit&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            ,@error            &lt;span class="kwrd"&gt;int&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            ,@error_desc    nvarchar(256)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;            ,@ret            smallint&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;IF @@TRANCOUNT &amp;gt; 0&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;        SET @local_tran = 0&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;    ELSE&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;     BEGIN&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;        BEGIN TRANSACTION&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;        SET @local_tran = 1        &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;     END&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;    INSERT        [dbo].[tblVersion] (&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;                    [CustomerName]&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;                    ,[WorkflowID]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;                    ,[WorkflowVersion]&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;                    ,[EndpointAddress]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;    )&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;VALUES&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;(&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;@CustomerName,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;@WFId,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;@Version,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;@EndpointAddr&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;IF @@ERROR NOT IN ( 3604 &lt;span class="rem"&gt;/* ignore dup key */&lt;/span&gt;, 0 )&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;     BEGIN&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  97:  &lt;/span&gt;        SELECT @error_desc = @localized_string_InsertCustomer_InsertFailed&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  98:  &lt;/span&gt;        GOTO FAILED&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  99:  &lt;/span&gt;     END&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 100:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 101:  &lt;/span&gt;    IF @local_tran = 1&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 102:  &lt;/span&gt;        COMMIT TRANSACTION&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 103:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 104:  &lt;/span&gt;    SET @ret = 0&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 105:  &lt;/span&gt;    GOTO DONE&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 106:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 107:  &lt;/span&gt;FAILED:&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 108:  &lt;/span&gt;    IF @local_tran = 1&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 109:  &lt;/span&gt;        ROLLBACK TRANSACTION&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 110:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 111:  &lt;/span&gt;    RAISERROR( @error_desc, 16, -1 )&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 112:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 113:  &lt;/span&gt;    SET @ret = -1&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 114:  &lt;/span&gt;    GOTO DONE&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 115:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 116:  &lt;/span&gt;DONE:&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 117:  &lt;/span&gt;    RETURN @ret&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 118:  &lt;/span&gt;END&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;In Conclusion&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I’m sure that there are those of you out there that can find flaws in this method, suggest improvements, or have other ways you’ve done this but I’ve found few concrete methods distributed in blogs.&amp;#160; I (and Xingang) were just hoping this could help someone along the way and maybe with suggestions from others, even improve what we have.&amp;#160; Comments welcome!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9904051" width="1" height="1"&gt;</description></item><item><title>WF 4.0 Beta 1 : How to Create a Declarative Sequential Service Library</title><link>http://blogs.msdn.com/ncdevguy/archive/2009/06/15/wf-4-0-beta-1-how-to-create-a-declarative-sequential-service-library.aspx</link><pubDate>Mon, 15 Jun 2009 20:23:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754091</guid><dc:creator>larrywa</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/9754091.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=9754091</wfw:commentRss><description>&lt;p&gt;Wow! It's been a long time since I've blogged about anything! It seems every time I think of something to blog about, I find some other blog that already talks about the same thing. I guess it's best I get over this because you never know who will find who's blog.&lt;/p&gt;  &lt;p&gt;After being in the trenches for so long with WF 3.0/3.5, SharePoint WF and WCF, I have finally had the opportunity to start digging into WF 4 &amp;amp; Visual Studio 2010 Beta 1. Workflow is headed for a very bright and exciting future, but like all new things, it's going to take some getting used to.&lt;/p&gt;  &lt;p&gt;So today, let's start by creating a 'Declarative Sequential Service Library' (workflow exposed as a WCF service). But first, lets understand a few things about this type of service.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Remember this is beta 1 and some functionality that might make this easier to implement does not yet exist. &lt;/li&gt;    &lt;li&gt;Remember that a declarative service is all about creating a workflow, exposed as a WCF service. This is something that takes a bit of effort in WF 3.5. &lt;/li&gt;    &lt;li&gt;Remember that when we say declarative, we mean, no code. And that is one of the key things here that tripped me up, because I kept trying to do things in code….and I couldn't. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;What will this example service represent?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Since spend a week every year at summer camp, I've decided to create a simple service that will confirm space in merit badge classes for summer camp. In our case to keep this simple, we will simply confirm space for any merit badge request. We will not be doing any sort of correlation in this example, we'll save that for later blog entries.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Creating the Service&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open Visual Studio 2010 Beta 1 and select &lt;strong&gt;File | New | Project | Visual C# | WCF | Declarative Sequential Service Library&lt;/strong&gt;. Give your project the name &lt;strong&gt;'ConfirmMeritBadge'&lt;/strong&gt; and select &lt;strong&gt;OK&lt;/strong&gt;. What you will be presented with is the new WF 4.0 designer surface with a sequence activity that contains a receive and send activity that work together somewhat as a unit. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image001_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image001_thumb.png" width="301" height="350" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As it stands at this point, you'll notice that you have an Operation Name of GetData, a Value of 'data' and no Correlates with value. You may recall from Visual Studio (2008/2010) that if you were to have selected just to create a WCF service, it would provide for you a contract named IService with an operation named GetData. This is the same sort of thing that is happening here. We are going to change these values though.&lt;/p&gt;  &lt;p&gt;Here is the data type we will be referencing within our service (I created this by creating a class library named MeritBadgeType and putting it in the same Visual Studio solution):&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Runtime.Serialization;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; MeritBadgeType
{
    [DataContract]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MeritBadge
    {
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _mBadgeName = &lt;span class="kwrd"&gt;default&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;);
        &lt;span class="kwrd"&gt;private&lt;/span&gt; Int16 _mBadgeSession = &lt;span class="kwrd"&gt;default&lt;/span&gt;(Int16);

        [DataMember]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; BadgeName
        {
            get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _mBadgeName; }
            set { _mBadgeName = &lt;span class="kwrd"&gt;value&lt;/span&gt;; }
        }

        [DataMember]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; Int16 BadgeSession
        {
            get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _mBadgeSession; }
            set { _mBadgeSession = &lt;span class="kwrd"&gt;value&lt;/span&gt;; }
        }
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Right click the &lt;strong&gt;Service1.xamlx&lt;/strong&gt; file in the Visual Studio solution and rename it to &lt;strong&gt;MeritBadgeService.xamlx&lt;/strong&gt;. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Add a reference to the assembly (MeritBadgeType) to the declarative service. I do this by selecting &lt;strong&gt;'Add Reference'&lt;/strong&gt; and then selecting my MeritBadgeType project in the same Visual Studio solution. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Build the solution. This may sound odd at this point, but if you don't do a build, you will not be able to see your referenced data type when you create your workflow variable. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Click in the workflow designer where you see an activity named &lt;strong&gt;'Sequential Service'&lt;/strong&gt;. This will highlight the entire sequence activity. In the properties window, set the &lt;em&gt;DisplayName&lt;/em&gt; property to &lt;strong&gt;'Confirm Badge'&lt;/strong&gt;. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;We need to create two workflow scoped level variables to hold our merit badge object and a boolean confirmation. With the Confirm Badge activity still selected, in the lower left hand corner of the workflow designer, select the 'Variables' button. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Create two variables by selecting 'Add New Variable': 
    &lt;br /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
  &lt;table border="0" cellspacing="0" cellpadding="2" width="752"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" width="200"&gt;&lt;u&gt;&lt;strong&gt;Variable Name&lt;/strong&gt;&lt;/u&gt;&lt;/td&gt;

        &lt;td valign="top" width="550"&gt;&lt;u&gt;&lt;strong&gt;Type&lt;/strong&gt;&lt;/u&gt;&lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="200"&gt;wfMeritBadge&lt;/td&gt;

        &lt;td valign="top" width="550"&gt;To set the type, select the drop-down in the Variable Type column and select '&lt;strong&gt;Browse for Types&lt;/strong&gt;'. A 'type' browser dialog box will appear and you will need to select the 'MeritBadgeType.MeritBadge' data type. Select Ok.

          &lt;br /&gt;&lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="200"&gt;wfBadgeConfirm&lt;/td&gt;

        &lt;td valign="top" width="550"&gt;The type will be a boolean that you can just select from the Variable Type drop-down.&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image002_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image002_thumb.png" width="378" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Click on the &lt;strong&gt;Receive Request&lt;/strong&gt; receive activity to highlight it. Change it's &lt;em&gt;DisplayName&lt;/em&gt; to &lt;strong&gt;'Receive Badge Request'&lt;/strong&gt;. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Click on the &lt;strong&gt;SendResponse&lt;/strong&gt; send activity and set it's &lt;em&gt;DisplayName&lt;/em&gt; to &lt;strong&gt;'Badge Reply'&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Setting up the Activities&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Now that we have everything named like we want it, we need to start setting up our internal activities to have operation and contract names like we wish for it to have. Select the Receive Badge Request activity. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Set the &lt;em&gt;Operation Name&lt;/em&gt; property to '&lt;strong&gt;ReserveBadgeSpace&lt;/strong&gt;'. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Set the &lt;em&gt;ServiceContractName&lt;/em&gt; property to '&lt;strong&gt;IConfirmBadge&lt;/strong&gt;'. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Set the &lt;strong&gt;Value&lt;/strong&gt; property to '&lt;strong&gt;wfMeritBadge&lt;/strong&gt;' 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Click on the Badge Reply Send activity. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Set the &lt;em&gt;Value&lt;/em&gt; property to '&lt;strong&gt;wfBadgeConfirm&lt;/strong&gt;'. 

    &lt;br /&gt;

    &lt;br /&gt;At this point, you may be asking, what did we just do here? Why couldn't I just browse to a contract or operation name? Well, in Beta 1, you do not have the capability to physically add your own contract, in code, and then browse to it. You also cannot browse to a referenced contract type. Basically, when you put this information into the properties of the Receive activity, the service contract and operation will be created on the fly, sort of like the Workflow First approach that was implemented in .Net 3.5. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now comes the tricky part. If I were to go and try to add a service reference to this service in a client app, what it would show me is that my actually service name is IService1, not IConfirmService. So how do we get this to work?&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Drag and drop an &lt;strong&gt;Assign&lt;/strong&gt; activity below the Receive Badge Request activity. Set the &lt;em&gt;DisplayName&lt;/em&gt; to &lt;strong&gt;Confirmed&lt;/strong&gt;. &lt;/li&gt;

  &lt;li&gt;In the Assign activity, set the &lt;em&gt;To&lt;/em&gt; property to &lt;strong&gt;wfBadgeConfirm&lt;/strong&gt; and the &lt;em&gt;Value&lt;/em&gt; property to &lt;strong&gt;True&lt;/strong&gt;. There is of course a lot more we could do in this service…we could go out to a database to figure out if there is room left for more students etc, but for now, I'll just set the return to true. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the end, your declarative service should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image003_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image003_thumb.png" width="239" height="352" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up the Service Name&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In the &lt;strong&gt;ConfirmMeritBadge&lt;/strong&gt; project, open up the web.config file. I'll just do it with an XML editor instead of the WCF Configuration Editor. You will see this: &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image004_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image004_thumb.png" width="602" height="211" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that in the config file, we need to change the name of the service being referenced to 'MeritBadgeService' which is the same name as the .xamlx file. Another thing you might notice is that you don't see an endpoint configured with an address or binding type. This is because, out of the box, this declarative service assumes you will be using basicHttpBinding and the address will be &lt;a href="http://localhost:%3csomeport%3e/MeritBadgeService.xamlx"&gt;http://localhost:&amp;lt;someport&amp;gt;/MeritBadgeService.xamlx&lt;/a&gt;. Also notice that metadata exposure is enabled.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Save the web.config file and close it. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Close the MeritBadgeService.xamlx file. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Right click on the MeritBadgeService.xamlx file in the solution explorer and choose &lt;strong&gt;Open With&lt;/strong&gt;. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Choose &lt;strong&gt;XML Editor&lt;/strong&gt; and select &lt;strong&gt;Ok&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image005_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image005" border="0" alt="clip_image005" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image005_thumb.png" width="598" height="78" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Change the &lt;em&gt;ConfigurationName&lt;/em&gt; and Name settings to &lt;strong&gt;MeritBadgeService&lt;/strong&gt;. Save the file and close it. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What we just did here (remember this is Beta 1 bits) is, to change the exposed service name, we had to go into the source code and change the service name. To re-open the MeritBadgeService.xamlx file in the workflow designer, double-click on it in the solution explorer. Rebuild the entire solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing the Service&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;First we perform a simple test just to make sure the service will work. Here, we are hosting via IIS, so right click on the ConfirmMeritBadge project and select &lt;strong&gt;'View In Browser'&lt;/strong&gt;. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;You will be presented with a directory listing of your service. You cannot click on the .xamlx file and view it in the browser because there is no menu item for this. You could just type in the address to the .xamlx file if you know the Visual Studio generated port number, but I'll do it this way first to see what port number will be used. 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;In the browser window, click on the MeritBadgeService.xamlx file. What you should see (if everything is working right is) &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image006_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image006_thumb.png" width="672" height="321" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;…and if you click on the wsdl link, you'll be able to see that indeed the service name is 'MeritBadgeService':&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image007_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image007" border="0" alt="clip_image007" src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/WF4.0Beta1HowtoCreateaDeclarativeSequent_9ACE/clip_image007_thumb.png" width="718" height="129" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about a real test?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For a real test, you can pretty much choose any type of client where you can add a service reference to (and that can call a basicHttp endpoint). What you need to do is add a service reference to the address: &lt;a href="http://localhost:1068/MeritBadgeService.xamlx"&gt;http://localhost:1068/MeritBadgeService.xamlx&lt;/a&gt; from the above example and the service reference will be added to your project. More info in the next post about how to set this up.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9754091" width="1" height="1"&gt;</description></item><item><title>Update: Hosting a Workflow Service in IIS</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/10/09/update-hosting-a-workflow-service-in-iis.aspx</link><pubDate>Thu, 09 Oct 2008 22:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8993184</guid><dc:creator>larrywa</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8993184.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8993184</wfw:commentRss><description>&lt;P&gt;It was January when I initially posted the steps on how to host a workflow, exposed as a WCF service, within IIS.&amp;nbsp; Since then, and more specifically, with the .Net 3.5 SP1 update, a nice feature has been added to ease this process.&lt;/P&gt;
&lt;P&gt;So what I will do here is take the same workflow service, or really it can be any workflow service, and go through the steps of how to host it in IIS.&lt;/P&gt;
&lt;H3&gt;The Workflow Service Project&lt;/H3&gt;
&lt;P&gt;So, as you may recall, we created a WCF Sequential Workflow Service Library from within Visual Studio 2008.&amp;nbsp; We then changed the interface (contract) file to IProductOrder and we changed the name of our workflow file to OrderProcessWF.cs.&amp;nbsp; Just to make sure we are on the same page, I'll show the code again:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;IProductOrder.cs&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;using System; &lt;BR&gt;using System.Collections.Generic; &lt;BR&gt;using System.Linq; &lt;BR&gt;using System.Text; &lt;BR&gt;using System.Runtime.Serialization; &lt;BR&gt;using System.ServiceModel; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;namespace WFHostedInIIS &lt;BR&gt;{ &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Service contract &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ServiceContract(Namespace = "&lt;/FONT&gt;&lt;A href="http://ncdevguyblog/Workflow" mce_href="http://ncdevguyblog/Workflow" )]?&gt;&lt;FONT face="Courier New" size=2&gt;http://ncdevguyblog/Workflow")]&lt;/FONT&gt;&lt;/A&gt; &lt;BR&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public interface IProductOrder &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void SubmitOrder(OrderInfo order); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderInfo GetOrder(string orderID); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Data type (contract) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataContract] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class OrderInfo &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private string orderID = default(string); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private string fName = default(string); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private string lName = default(string); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string OrderID &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return orderID; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { orderID = value; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string FName &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return fName; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { fName = value; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string LName &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return lName; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { lName = value; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;OrderProcessWF.cs (designer mode)&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=240 alt=image src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/image_thumb.png" width=360 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;app.config file&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt; &lt;BR&gt;&amp;lt;configuration&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;system.web&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;compilation debug="true" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/system.web&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service behaviorConfiguration="WFHostedInIIS.Workflow1Behavior" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="WFHostedInIIS.OrderProcessWF"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address="" binding="wsHttpContextBinding" contract="WFHostedInIIS.IProductOrder"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;identity&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dns value="localhost" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/identity&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/endpoint&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="&lt;/FONT&gt;&lt;A href="http://localhost:8731/Design_Time_Addresses/WFHostedInIIS/OrderProcessWF/" mce_href="http://localhost:8731/Design_Time_Addresses/WFHostedInIIS/OrderProcessWF/" ?&gt;&lt;FONT face="Courier New" size=2&gt;http://localhost:8731/Design_Time_Addresses/WFHostedInIIS/OrderProcessWF/"&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Courier New" size=2&gt; /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="WFHostedInIIS.Workflow1Behavior"&amp;nbsp; &amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceDebug includeExceptionDetailInFaults="false" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceCredentials&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;windowsAuthentication &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allowAnonymousLogons="false" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; includeWindowsGroups="true" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceCredentials&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt; &lt;BR&gt;&amp;lt;/configuration&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So at this point, I'm assuming you have your project created, compiled and ready for work.&lt;/P&gt;
&lt;H3&gt;Publishing the Project to IIS&lt;/H3&gt;
&lt;P&gt;With .Net 3.5 SP1, Microsoft has added a mechanism (wizard) in which we can publish our services to be hosted in IIS.&amp;nbsp; Basically what they did was, they used the ASP.Net publishing wizard and added it as a context menu item.&lt;/P&gt;
&lt;P&gt;1. First, assuming your project is open, what you will need to do is go into the project properties and de-select the checkbox under the WCF Options tab.&amp;nbsp; This will prevent Visual Studio from trying to provide its default WCF service host.&amp;nbsp; Since we will have IIS for our host, we don't need this. BTW, this checkbox is a new option in .Net 3.5 SP1.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/WcfOptions_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/WcfOptions_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=304 alt=WcfOptions src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/WcfOptions_thumb.png" width=473 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/WcfOptions_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Click on the Debug tab and make sure the Command line arguments do not have any reference to the WCFTestClient.exe.&amp;nbsp; You will normally see this there because Visual Studio adds this to WCF service projects created with the Visual Studio project templates.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/DebugOptions_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/DebugOptions_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=257 alt=DebugOptions src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/DebugOptions_thumb.png" width=478 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/DebugOptions_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;3.&amp;nbsp; Right click on WFHostedInIIS project and select &lt;STRONG&gt;'Publish'&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/publishmenu_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/publishmenu_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=178 alt=publishmenu src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/publishmenu_thumb.png" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/publishmenu_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;4.&amp;nbsp; In the dialog that appears, enter &lt;A href="http://localhost/IISHostingOfWorkflow" mce_href="http://localhost/IISHostingOfWorkflow"&gt;http://localhost/IISHostingOfWorkflow&lt;/A&gt; as the &lt;STRONG&gt;Target Location&lt;/STRONG&gt; and click the &lt;STRONG&gt;Publish&lt;/STRONG&gt; button.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/PublishWindow_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/PublishWindow_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=362 alt=PublishWindow src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/PublishWindow_thumb.png" width=493 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/PublishWindow_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;5.&amp;nbsp; Right click the WFHostedInIIS solution and select &lt;STRONG&gt;Add | Existing Web Site&lt;/STRONG&gt;...&lt;/P&gt;
&lt;P&gt;6.&amp;nbsp; Select the IIS application &lt;STRONG&gt;'IISHostingOfWorkflow'&lt;/STRONG&gt; and select &lt;STRONG&gt;Open&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/inetmgr_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/inetmgr_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=396 alt=inetmgr src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/inetmgr_thumb.png" width=497 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/inetmgr_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;7.&amp;nbsp;&amp;nbsp; To do an initial test, right click on the .svc file and select &lt;STRONG&gt;'View in Browser'&lt;/STRONG&gt;. If everything is working correctly, you should see a service page appear in your web browser.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/BrowserView_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/BrowserView_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=447 alt=BrowserView src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/BrowserView_thumb.png" width=682 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/BrowserView_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;8.&amp;nbsp; Instead of going through the whole process of creating a test client, we can use the WCFTestClient to test our methods. Click on the website project &lt;A href="http://localhost/IISHostingOfWorkflow'" mce_href="http://localhost/IISHostingOfWorkflow'"&gt;http://localhost/IISHostingOfWorkflow'&lt;/A&gt; and then select &lt;STRONG&gt;Property Pages&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;9.&amp;nbsp; Click on &lt;STRONG&gt;Start Options&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;10. Set Start external program to &lt;STRONG&gt;'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe'&lt;/STRONG&gt; and Command line arguments to &lt;STRONG&gt;'http://localhost/IISHostingOfWorkflow/WFHostedInIis.OrderProcessWF.svc'&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/startoptions_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/startoptions_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=340 alt=startoptions src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/startoptions_thumb.png" width=588 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/startoptions_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;11.&amp;nbsp; To test the service with the WCFTestClient interface, right click on the website project and select &lt;STRONG&gt;Set As Startup Project&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;12.&amp;nbsp; Select &lt;STRONG&gt;F5&lt;/STRONG&gt; to begin debugging. The test client should appear and you are able to enter data into the fields for testing.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/TestClient2_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/TestClient2_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=377 alt=TestClient2 src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/TestClient2_thumb.png" width=598 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/UpdateHostingaWorkflowServiceinIIS_D831/TestClient2_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;So there we have it.&amp;nbsp; We could of course build some other sort of client interface, add a service reference and point to the .svc file as the address, but the point is, compared to the old way of doing it, we have relatively few steps to get this up and running.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8993184" width="1" height="1"&gt;</description></item><item><title>Changing the Look</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/10/08/changing-the-look.aspx</link><pubDate>Wed, 08 Oct 2008 19:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8991688</guid><dc:creator>larrywa</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8991688.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8991688</wfw:commentRss><description>I was told recently by someone reading my blog that some of my code was being cut off on the right hand side of the blog border. I've changed the look now to allow for easier reading. Hope this helps!&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8991688" width="1" height="1"&gt;</description></item><item><title>HowTo: Create a Custom Action for an Office SharePoint Designer Workflow - Part 3</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/09/10/howto-create-a-custom-action-for-an-office-sharepoint-designer-workflow-part-3.aspx</link><pubDate>Thu, 11 Sep 2008 02:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8942395</guid><dc:creator>larrywa</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8942395.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8942395</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;Ok, so if you've been following along up to this point in grand anticipation, this is going to be a happy time for you...we now get to test our custom action.&lt;/H5&gt;
&lt;H4&gt;&lt;A class="" title=_Toc208662067 name=_Toc208662067&gt;&lt;/A&gt;Step 1 – Create the Workflow&lt;/H4&gt;
&lt;P&gt;1. Open SPD to the site &lt;A href="http://%3cyourmachineanddomain.com%3e/FleetCustomers" mce_href="http://&lt;yourmachineanddomain.com&gt;/FleetCustomers"&gt;&lt;B&gt;http://&amp;lt;yourmachineanddomain.com&amp;gt;/FleetCustomers&lt;/B&gt;&lt;/A&gt; by clicking &lt;B&gt;File &amp;gt; Open Site&lt;/B&gt;. &lt;/P&gt;
&lt;P&gt;2. Click on the root folder and &lt;FONT size=2&gt;then&lt;/FONT&gt; select &lt;B&gt;File-&amp;gt;New-&amp;gt;Workflow&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;3. Give the Workflow the name &lt;B&gt;'Fleet Customer&lt;/B&gt;" and attach it to the &lt;B&gt;'Fleet Customer Lib Request&lt;/B&gt;' document library. Make sure the workflow can be started manually.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD1_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD1_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=415 alt=SPD1 src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD1_thumb.png" width=531 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD1_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;4. Click &lt;B&gt;Next&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;5. Name the Step ‘&lt;B&gt;Create Doc Lib’&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;6. Select the Actions button and then select &lt;B&gt;'Create Fleet Document Library'&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;7. Click &lt;B&gt;Name of the &lt;/B&gt;doclib and using the Function button, select &lt;B&gt;Current Item&lt;/B&gt; and then ‘&lt;B&gt;Customer Name&lt;/B&gt;'.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD2_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD2_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=135 alt=SPD2 src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD2_thumb.png" width=315 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD2_thumb.png"&gt;&lt;/A&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;8. Click &lt;B&gt;Link to site&lt;/B&gt; and type in a site name of &lt;A href="http://%3cyourmachineanddomain.com%3e/FleetCustomers" mce_href="http://&lt;your"&gt;http://&amp;lt;yourmachineanddomain.com&amp;gt;/FleetCustomers&lt;/A&gt; . (the /fleetcustomers sub-site is hard coded in the application)&lt;/P&gt;
&lt;P&gt;Your Action should look like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD3_2.png" mce_href="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD3_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=86 alt=SPD3 src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD3_thumb.png" width=519 border=0 mce_src="http://blogs.msdn.com/blogfiles/ncdevguy/WindowsLiveWriter/HowToCreateaCustomActionforanOfficeShare_D326/SPD3_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;9. Check the Workflow for Errors. Select &lt;B&gt;Finish&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;H4&gt;&lt;A class="" title=_Toc208662068 name=_Toc208662068&gt;&lt;/A&gt;Step 2 – Testing the Workflow&lt;/H4&gt;
&lt;P&gt;1. Go back to the site &lt;A href="http://%3cyourmachineanddomain.com%3e/FleetCustomers" mce_href="http://&lt;yourmachineanddomain.com&gt;/FleetCustomers"&gt;http://&amp;lt;yourmachineanddomain.com&amp;gt;/FleetCustomers&lt;/A&gt; via Internet Explorer.&lt;/P&gt;
&lt;P&gt;2. Click on &lt;B&gt;Fleet Customer Lib Request&lt;/B&gt; in the Documents menu and create a new document. It does not matter at this point what the content of the Word document is or the name that you save it as. What is important is that you fill in the &lt;B&gt;Customer Name&lt;/B&gt; and &lt;B&gt;Title&lt;/B&gt; on the document properties ribbon bar. &lt;/P&gt;
&lt;P&gt;This information will be used to create the new doc lib.&lt;/P&gt;
&lt;P&gt;3. Put in a customer name of &lt;B&gt;'MyFleetCustomer'&lt;/B&gt; and a title of '&lt;B&gt;I want a new truck&lt;/B&gt;'.&lt;/P&gt;
&lt;P&gt;4. Save the document to the &lt;B&gt;Fleet Customer Lib Request&lt;/B&gt; document library.&lt;/P&gt;
&lt;P&gt;5. Execute the &lt;B&gt;Fleet Customer&lt;/B&gt; workflow against the new document by clicking the drop-down arrow adjacent to the document name and then selecting Workflows then Fleet Customer. &lt;/P&gt;
&lt;P&gt;6. You will be prompted to start the workflow, select the Start button.&lt;/P&gt;
&lt;P&gt;7. Go back to the root site. &lt;/P&gt;
&lt;P&gt;8. Click on &lt;B&gt;Tasks&lt;/B&gt;. You should see a new task that was created for the administrator to read.&lt;/P&gt;
&lt;P&gt;9. Click on the &lt;B&gt;Fleet Customers&lt;/B&gt; site menu item.&lt;/P&gt;
&lt;P&gt;10. Click on &lt;B&gt;View All Site Content&lt;/B&gt;. You should see the new &lt;STRONG&gt;MyFleetCustomer&lt;/STRONG&gt; document library.&lt;/P&gt;
&lt;P&gt;So there you have it! In this three part series, we have created a custom activity that represents our new action, created an .ACTIONS file that will be used by SharePoint to know what to display on the menu and which fields the action needs and, we've tested the workflow.&lt;/P&gt;
&lt;P&gt;I hope you find this information useful. Let me know if you find anything wrong our have better suggestions on how to do something.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8942395" width="1" height="1"&gt;</description></item><item><title>HowTo: Create a Custom Action for an Office SharePoint Designer Workflow - Part 2</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/09/10/howto-create-a-custom-action-for-an-office-sharepoint-designer-workflow-part-2.aspx</link><pubDate>Thu, 11 Sep 2008 02:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8942366</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8942366.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8942366</wfw:commentRss><description>&lt;P&gt;So, in my last post we went through the first steps of what we need to do to create a custom action for Office SharePoint Designer (SPD).&amp;nbsp; In Part 2, we will add the necessary .ACTION file and make a modification to our web applications web.config file to get our component successfully registered and authorized.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;Creating the .ACTION file&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;1. Create a new text file named CreateFleetDocLib.ACTIONS and save it to:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;C:\MSDNBlog\SPD\CreateFleetDocLib\CreateFleetDocLib&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We are only saving this file here so it is contained in the same project. It is not compiled with the project.&lt;/P&gt;
&lt;P&gt;2. Add the following code to the text file you just created &lt;BR&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt; &lt;BR&gt;&amp;lt;WorkflowInfo&amp;gt; &lt;BR&gt;&amp;lt;Actions Sequential="then" Parallel="and"&amp;gt; &lt;BR&gt;&amp;lt;Action Name="Create Fleet Document Library" ClassName="CreateFleetDocLib.FleetDocLibActivity" Assembly="CreateFleetDocLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a796aa76103ee0c2" AppliesTo="all" Category="Labs"&amp;gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;lt;RuleDesigner Sentence="Create fleet document library %1 on %2."&amp;gt; &lt;BR&gt;&amp;lt;FieldBind Field="CompanyName" Text="Name of the doclib" Id="2" DesignerType="TextArea"/&amp;gt; &lt;BR&gt;&amp;lt;FieldBind Field="Url" Text="Link to site" DesignerType="TextArea" Id="1"/&amp;gt; &lt;BR&gt;&amp;lt;/RuleDesigner&amp;gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;lt;Parameters&amp;gt; &lt;BR&gt;&amp;lt;Parameter Name="Url" Type="System.String, mscorlib" Direction="In" /&amp;gt; &lt;BR&gt;&amp;lt;Parameter Name="CompanyName" Type="System.String, mscorlib" Direction="In" /&amp;gt; &amp;lt;/Parameters&amp;gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;lt;/Action&amp;gt; &lt;BR&gt;&amp;lt;/Actions&amp;gt; &lt;BR&gt;&amp;lt;/WorkflowInfo&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A couple of things to note here about two of the elements in this file: &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;lt;RuleDesigner&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; - this element represents the text you will see in the actions menu inside of the SPD wizard. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;lt;FieldBind&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; - this element represents the fields that you will need to fill in in the designer once you have this action item dropped into the designer form.&amp;nbsp; The important thing here is that the 'Field' attribute value needs to be the same as a &amp;lt;Parameter&amp;gt; 'Name' attribute in the section below it.&amp;nbsp; So for example, we have a Field="CompanyName" and a Parameter Name="CompanyName".&lt;/P&gt;
&lt;P&gt;3. Browse to the &lt;B&gt;&lt;I&gt;C:\Windows\Assembly&lt;/I&gt;&lt;/B&gt; directory and right click on the &lt;B&gt;CreateFleetDocLib&lt;/B&gt; assembly and select &lt;B&gt;Properties&lt;/B&gt;. Copy the &lt;B&gt;Public Key Token&lt;/B&gt; to the clipboard.&lt;/P&gt;
&lt;P&gt;4. In the &lt;STRONG&gt;CreateFleetDocLib.ACTIONS&lt;/STRONG&gt; file, replace the PublicKeyToken with the Public key token you copied to the clipboard.&lt;/P&gt;
&lt;P&gt;5. Copy the CreateFleetDocLib.ACTIONS file into the following directory:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\Workflow&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;H4&gt;&lt;A class="" title=_Toc208662065 name=_Toc208662065&gt;&lt;/A&gt;Modifying web.config&lt;/H4&gt;
&lt;P&gt;1. Browse to the directory:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Inetpub\wwwroot\wss\VirtualDirectories\&lt;/I&gt;&lt;/B&gt; &amp;lt;yourmachineanddomain&amp;gt;&lt;/P&gt;
&lt;P&gt;2. Open up the &lt;B&gt;web.config&lt;/B&gt; file for editing.&lt;/P&gt;
&lt;P&gt;3. Add the following to the AuthorizedTypes section of the web.config file. &lt;/P&gt;
&lt;P&gt;&amp;lt;authorizedType Assembly="CreateFleetDocLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a796aa76103ee0c2" Namespace="CreateFleetDocLib" TypeName="*" Authorized="True" /&amp;gt;&lt;/P&gt;
&lt;P&gt;4. Save the web.config file&lt;/P&gt;
&lt;P&gt;5. Restart IIS (iisreset).&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8942366" width="1" height="1"&gt;</description></item><item><title>HowTo: Create a Custom Action for an Office SharePoint Designer Workflow - Part 1</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/09/10/howto-create-a-custom-action-for-an-office-sharepoint-designer-workflow-part-i.aspx</link><pubDate>Wed, 10 Sep 2008 21:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8941511</guid><dc:creator>larrywa</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8941511.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8941511</wfw:commentRss><description>&lt;P&gt;Sorry about the long title, but I thought it may help when someone is doing a search for such a topic.&amp;nbsp; On with the show....&lt;/P&gt;
&lt;P&gt;Invariably, if you are using Office SharePoint Designer (SPD) to create workflows, your power users are going to say 'Hey, I really like this but I want to have an Action that does &lt;EM&gt;xyz&lt;/EM&gt;'.&amp;nbsp; Nobody ever seems just satisfied with what we get out of the box, but that's the beauty of the Microsoft platform, its extensible!&lt;/P&gt;
&lt;P&gt;So in part 1, we will talk about the first steps to creating a custom action.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Scenario&lt;/STRONG&gt; &lt;BR&gt;Suppose we have a situation where we have a car dealership that caters to customers that purchase fleets of vehicles.&amp;nbsp; The idea here would be that whenever a new fleet customer wants to sign an order, we would want to take that order form and use it to create a unique site (or document library) for this client.&amp;nbsp; I'd like to be able to create an action where I could pick from that would allow me to pick up the customers name from the document and use that to create my new document library.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=3&gt;Part 1 - Creating our Custom Action&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1. First, we need to setup a sample site in WSS (3.0) or MOSS to use as our base site. Go ahead and create a site &lt;A href="http://%3cyourmachineanddomain.com/FleetCustomers." mce_href="http://&lt;yourmachineanddomain.com/SPDAction"&gt;http://&amp;lt;yourmachineanddomain.com/FleetCustomers.&lt;/A&gt;&amp;nbsp;Create a new document library named &lt;STRONG&gt;'Fleet Customer Doc Lib'&lt;/STRONG&gt;.&amp;nbsp; In&amp;nbsp;this document library, create a new custom column (single line of text) named &lt;STRONG&gt;'Customer Name'&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A custom Action is actually just a custom workflow activity that is registered with the system using an .ACTIONS file, so now we will create a custom activity.&lt;/P&gt;
&lt;P&gt;2. Create a new workflow activity library project in Visual Studio 2008 in some location on your machine for example 'C&lt;B&gt;:\MSDNBlog\SPD&lt;/B&gt;' Give it the name &lt;B&gt;'CreateFleetDocLib'&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;3. Rename &lt;STRONG&gt;Activity.cs&lt;/STRONG&gt; to &lt;B&gt;FleetDocLibActivity.cs. &lt;/B&gt;Open the code view to the activity.&lt;/P&gt;
&lt;P&gt;4. Change the base class from &lt;STRONG&gt;SequenceActivity&lt;/STRONG&gt; to &lt;B&gt;Activity&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;5. Create two Dependency properties (both strings): &lt;BR&gt;&lt;/P&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=400 border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=100&gt;Property Name&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Data Type&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Category&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Description&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=100&gt;Url&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;string&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Input Property&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Url of base site&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=100&gt;CompanyName&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;string&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Input Property&lt;/TD&gt;
&lt;TD class="" vAlign=top width=100&gt;Used as doc lib name&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;This can also be done by using &lt;B&gt;Insert Snippet &amp;gt; Other &amp;gt; Workflow &amp;gt; Dependency Property – Property&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;6. To make sure we require validation on each of these entries (meaning we have to have input), put the following above each of the properties:&lt;/P&gt;
&lt;P&gt;[ValidationOption(ValidationOption.Required)]&lt;/P&gt;
&lt;P&gt;The code for the dependency properties should look like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;#region Dep Props&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;public static DependencyProperty UrlProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Url", typeof(string),typeof(FleetDocLibActivity));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;[Description("Base URL of site")] &lt;BR&gt;[Category("Input Property")] &lt;BR&gt;[Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)[ValidationOption(ValidationOption.Required)] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;public string Url &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;get &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;return ((string)(base.GetValue &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Courier&gt;&lt;FONT color=#0000a0&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;(FleetDocLibActivity.UrlProperty))); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;base.SetValue(FleetDocLibActivity.UrlProperty, value); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;} &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;public static DependencyProperty CompanyNameProperty = System.Workflow.ComponentModel.DependencyProperty.Register("CompanyName",&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;typeof(string), typeof(FleetDocLibActivity)); &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;[Description("Name of the fleet company")] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;[Category("Input Property")] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;[Browsable(true)] &lt;BR&gt;[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;[ValidationOption(ValidationOption.Required)] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;public string CompanyName &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;get &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ((string)(base.GetValue&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Courier&gt;&lt;FONT color=#0000a0&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;(FleetDocLibActivity.CompanyNameProperty))); &lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp; set &lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;base.SetValue(FleetDocLibActivity.CompanyNameProperty, value); &lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;} &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;#endregion&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;7. Add an EventLog variable to the FleetDocLibActivity class along with other variables used for the sites and webs to be accessed.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;#region Member Variables&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;private EventLog _eventLog;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;//main site &lt;BR&gt;SPSite mainSite = null; &lt;BR&gt;SPWeb rootweb = null;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;//sub site &lt;BR&gt;SPSite subSite = null; &lt;BR&gt;SPWeb subWeb = null;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;#endregion&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;8. Insert the following code inside of the FleetDocLibActivity class (after the constructor)&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set up the Event Logging object&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog = new EventLog("Workflow"); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog.Source = "SharePoint Workflow"; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Send the email&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateDocLib(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Dispose of the Event Logging &lt;/FONT&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&lt;BR&gt;&lt;FONT color=#0000a0&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // object&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog.Dispose(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Indicate the activity has closed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ActivityExecutionStatus.Closed; &lt;BR&gt;} &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;private void CreateDocLib() &lt;BR&gt;{ &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mainSite = new SPSite(Url); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootweb = mainSite.OpenWeb(); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //sub site &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subSite = new SPSite(Url + "/FleetCustomers"); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subWeb = subSite.OpenWeb(); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get the list collection for the main and sub &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // sites&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPListCollection lists = subWeb.Lists; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPListCollection rootLists = rootweb.Lists; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //we are going to create a new doc lib in the &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //sub-site, create a new empty template&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //type then set the type to be a doc library &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPListTemplateType listTemplateType = new SPListTemplateType(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listTemplateType = SPListTemplateType.DocumentLibrary; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lists.Add(CompanyName, "", listTemplateType); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPList taskList = null; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //look for the tasks lists in the root web &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //also note that SPQuery could be used here&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (SPList lst in rootLists) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (lst.Title.Equals("Tasks", &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringComparison.InvariantCultureIgnoreCase)) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskList = lst; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (taskList != null) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //add a new task item for the administrator &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPListItem newItem = taskList.Items.Add(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newItem["Title"] = "Required completion of Doc Lib " + CompanyName; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newItem["Customer Name"] = CompanyName; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newItem.Update(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog.WriteEntry("Task assigned to admin"); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog.WriteEntry("Workflow success: Document Library created at: " + rootweb.Title.ToString()); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (System.Exception Ex) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Log exceptions in the Event Log&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _eventLog.WriteEntry("Workflow Error :" + Ex.Message.ToString(), EventLogEntryType.Information); &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mainSite.Dispose(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subSite.Dispose(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootweb.Dispose(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subWeb.Dispose(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;} //end CreateDocLib &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;9.&amp;nbsp; Add the following using statements to the file: &lt;BR&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Courier color=#0000a0 size=2&gt;using System.Diagnostics; &lt;BR&gt;using Microsoft.SharePoint; &lt;BR&gt;using Microsoft.SharePoint.Workflow; &lt;BR&gt;using Microsoft.SharePoint.WorkflowActions;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;10. Add a reference to your project to these (note that you may have to browse for this assemblies) SharePoint assemblies:&lt;/P&gt;
&lt;P&gt;Under the .NET tab&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Windows SharePoint Services &lt;BR&gt;Windows SharePoint Services Workflow Actions&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;- If you can’t find the assemblies you can browse directly to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\ &lt;BR&gt;- Microsoft.SharePoint.dll &lt;BR&gt;- microsoft.sharepoint.WorkflowActions.dll&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;11. Go into the CreateFleetDocLib project properties and create a new strong named assembly file named &lt;B&gt;FleetLib.snk&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;12. Build the assembly and resolve any errors.&lt;/P&gt;
&lt;P&gt;13. Using the &lt;B&gt;Visual Studio command prompt&lt;/B&gt;, place the library into the GAC by running the following command (NOTE: Don't forget the double quotes around the path to the assembly):&lt;/P&gt;
&lt;P&gt;&lt;B&gt;gacutil /i "C:\MSDNBlog\SPD\CreateFleetDocLib\CreateFleetDocLib\bin\Debug\CreateFleetDocLib.dll"&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;At this point, we have built the activity that will be used to handle our custom action.&amp;nbsp; In the Part II, we will create our custom action file.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8941511" width="1" height="1"&gt;</description></item><item><title>Where's my SvcTraceViewer.exe?</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/05/26/where-s-my-svctraceviewer-exe.aspx</link><pubDate>Tue, 27 May 2008 01:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8553923</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/8553923.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=8553923</wfw:commentRss><description>&lt;P&gt;I decided to move into the brave new world of Windows Server 2008. My intention was to setup a new VPC image to do some testing with WCF.&lt;/P&gt;
&lt;P&gt;As I recalled from my experiments with WPF, there is an issue with XAML intellisense be disabled if you install the new Windows Server 2008 / .Net 3.5 SDK &lt;U&gt;after&lt;/U&gt; Visual Studio 2008.&amp;nbsp; So, I decided to install the SDK first. There is a solution to the XAML issue by the way at:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2892404&amp;amp;SiteID=1" mce_href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2892404&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2892404&amp;amp;SiteID=1&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Much to my surprise, after I installed the SDK, I could not find one of my favorite tools (SvcTraceViewer.exe) in the sdk bin directory. I went back and checked to make sure that I installed all the .Net pieces correctly but still it wasn't there. It wasn't until AFTER I installed Visual Studio 2008 that I realized that when you install Visual Studio, Visual Studio will install these WCF tools for you.&lt;/P&gt;
&lt;P&gt;I also noticed that on Windows 2008 Server, that after installing Visual Studio 2008, a new directory was created under C:\Program Files\Microsoft SDKs\Windows named v6.0a. Under this bin directory is where I found the WCF tools. This is sort of interesting because on my Vista machine, I just have one directory v6.1 and it's bin directory has all the tools.&lt;/P&gt;
&lt;P&gt;So, either way, Visual Studio should install the final tools for you.&lt;/P&gt;
&lt;P&gt;I thought maybe this piece of information might be useful for other who might be wondering why the SDK install doesn't provide these tools.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8553923" width="1" height="1"&gt;</description></item><item><title>HOWTO: Host a Workflow Service in IIS (the whole story)</title><link>http://blogs.msdn.com/ncdevguy/archive/2008/01/02/howto-host-a-workflow-service-in-iis-the-whole-story.aspx</link><pubDate>Thu, 03 Jan 2008 02:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6960531</guid><dc:creator>larrywa</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/6960531.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=6960531</wfw:commentRss><description>&amp;nbsp; 
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.39in; DIRECTION: ltr; FONT-FAMILY: Arial; unicode-bidi: embed"&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I started out in my attempt to figure out how to host a workflow service in IIS by looking at the following MSDN article:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;How to: Host a Workflow Service in IIS&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/bb675264.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb675264.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb675264.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;This gave me 'most' of the information I needed but as is usual for me, it's the small missing pieces of information that end up creating the most grief for me.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So, I thought I would put down all the steps it took, from start to finish in hopes that this may help someone else.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;What we are going to be doing is hosting an existing, pre-compiled workflow as a service in IIS (on Vista). What this implies is that we are going to create a workflow library project.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is what tripped me up because there is a particular way you need to do this otherwise you have to end up adding a lot of your own code.&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0in; FONT-FAMILY: Arial; TEXT-DECORATION: underline"&gt;Setting up things in IIS&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;First, you have to make sure you have IIS installed on the machine and that it's running.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Therefore you need to go through the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Control Panel | Programs and Features | Turn Windows features on and off&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; and select &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Internet Information Services.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Open the Internet Information Services Manager by going to &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Control Panel | Administrative Tools | Internet Information Services (IIS) Manager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=3&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Create a new virtual directory by right clicking on &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Default Web Site&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; and selecting '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Add Virtual Directory&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;'. Here you will need to give this virtual directory an alias name and point it to a physical directory on the machine.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For the same of our sample, I'm going to give the alias the name of '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;IISWorkflowHost&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;' and point it to a directory I've already named on my machine '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;C:\IISHostForWorkflow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;'.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I have named the alias and directory differently the help you understand they don't need to necessary be named the same thing and to also show how we reference our service later on in the blog.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=4&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Double click on the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Authentication&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; icon in the IIS section.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You need to enable &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Windows Authentication&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=5&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Looking in the IIS Manager (left hand tree view), you will see the new folder for IISWorkflowHost.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is just a directory however and to get this to work correctly you need to right click on the directory and select '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Convert to Application'&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can just select OK from the dialog box that pops up or you can change the AppPool if desired.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For this example, we'll just accept the defaults.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This step was one of the things I was missing when I tried to get it working initially.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=6&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Create a &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Bin&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; directory under the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;C:\IISHostForWorkflow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; directory.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is where you will end up putting the workflow assembly that we will create later.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Before we do any further additions to our virtual directory, let's go create our workflow service.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0in; FONT-FAMILY: Arial; TEXT-DECORATION: underline"&gt;Creating the Workflow Service&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Open Visual Studio 2008 and select &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;File | New | Project | Visual C# | WCF | Sequential Workflow Service Library&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Give it the name of &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;WFToHostInIIS&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; and put it in the directory &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;C:\IISHostedWFExample&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;. Select&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; OK&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Rename Workflow1.cs to &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;OrderProcessWF.cs&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=3&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Rename IWorkflow1.cs (the contract file) to&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; IProductOrder.cs&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=4&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;We need to replace ALL the code in the IProductOrder.cs file with:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System.Collections.Generic;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System.Linq;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System.Text;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System.Runtime.Serialization;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;using System.ServiceModel;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;namespace WFToHostInIIS&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//Service contract &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[ServiceContract(Namespace = "&lt;A href="http://ncdevguyblog/Workflow" mce_href="http://ncdevguyblog/Workflow"&gt;http://ncdevguyblog/Workflow&lt;/A&gt;")]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public interface IProductOrder&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[OperationContract]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;void SubmitOrder(OrderInfo order);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[OperationContract]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;OrderInfo GetOrder(string orderID);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//Data type (contract)&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DataContract]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public class OrderInfo&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;private string orderID = default(string);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;private string fName = default(string);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;private string lName = default(string);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DataMember]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public string OrderID&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get { return orderID; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;set { orderID = value; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DataMember]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public string FName&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get { return fName; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;set { fName = value; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DataMember]&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public string LName&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get { return lName; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;set { lName = value; }&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;This service exposes two methods, one for submitting an order, the other for getting order info. For simplicity, we are only going to implement SubmitOrder.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=5&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Open OrderProcessWF in the workflow designer.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Click on the Receive activity that you see on the designer surface and rename it to &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;RcvSubmitOrder&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=6&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Click on the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;ServiceOperationInfo&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; property, select the ellipse on the right hand side and &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Import&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; the IProductOrder contract. You may not actually need to import it, but if the SubmitOrder method doesn't show up in the Operations list, you'll need to import.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=7&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Select the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;SubmitOrder&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; operation. Select &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;OK&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=8&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Click on the '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;order&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;' parameter and then select the ellipse that will take you to the property/field binding dialog box.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Select &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Bind to a new Member&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; tab and then create a new property named &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;WFOrderInfo&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;. Select &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;OK&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.39in; DIRECTION: ltr; FONT-FAMILY: Arial; unicode-bidi: embed"&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=9&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Open the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;app.config&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; file.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Everywhere you see 'IWorkflow1', replace that with 'IProductOrder'.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=10&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;For the&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: Calibri"&gt;&amp;lt;service name="WFToHostInIIS.Workflow1"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;, change this to&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: Calibri"&gt; &amp;lt;service name="WFToHostInIIS.OrderProcessWF"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=11&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;For the base addresses:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;add baseAddress="&lt;A href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/Workflow1/" mce_href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/Workflow1/"&gt;http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/Workflow1/&lt;/A&gt;" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;Change this to:&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;add baseAddress="&lt;A href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/OrderProcessWF/" mce_href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/OrderProcessWF/"&gt;http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/&lt;SPAN style="COLOR: blue"&gt;OrderProcessWF&lt;/SPAN&gt;/&lt;/A&gt;" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;Note that your port number may be different in your case. This does not matter.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In the end, your app.config would look something like this:&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;configuration&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;system.web&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;compilation debug="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/system.web&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;system.serviceModel&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;service name="WFToHostInIIS.OrderProcessWF" behaviorConfiguration="WFToHostInIIS.Workflow1Behavior"&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;host&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;add baseAddress="&lt;A href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/OrderProcessWF/" mce_href="http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/OrderProcessWF/"&gt;http://localhost:8731/Design_Time_Addresses/WFToHostInIIS/OrderProcessWF/&lt;/A&gt;" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/baseAddresses&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/host&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;endpoint address=""&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;binding="wsHttpContextBinding"&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;contract="WFToHostInIIS.IProductOrder"&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;!-- &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Upon deployment, the following identity element should be removed or replaced to reflect the &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;identity under which the deployed service runs.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If removed, WCF will infer an appropriate identity &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;automatically.&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;--&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;identity&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;dns value="localhost"/&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/identity&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/endpoint&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;endpoint address="mex" &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;binding="mexHttpBinding" &lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;contract="IMetadataExchange" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/service&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;behaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;serviceBehaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;behavior name="WFToHostInIIS.Workflow1Behavior"&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;serviceMetadata httpGetEnabled="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;serviceDebug includeExceptionDetailInFaults="false" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;serviceCredentials&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;windowsAuthentication&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;allowAnonymousLogons="false"&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;includeWindowsGroups="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/serviceCredentials&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/behavior&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/serviceBehaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/behaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/configuration&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri; TEXT-DECORATION: underline" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0in; FONT-FAMILY: Arial; TEXT-DECORATION: underline"&gt;Finishing the configuration for IIS&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Since we are still within Visual Studio, we are going to create a new web.config file to put in the virtual directory/application we created. Just choose &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;File | New | File | Web | Web Configuration File&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now what you are going to see is a configuration file that has a LOT of things that you don't need for this&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;example. Just replace the entire contents of this file with:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;configuration&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/configuration&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;We need to add our own code to the web.config file within the &amp;lt;configuration&amp;gt; section.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Paste in the following code:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;system.serviceModel&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;service name="WFToHostInIIS.OrderProcessWF" behaviorConfiguration="ServiceBehavior"&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.5in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;endpoint address="ContextOverHttp" binding="wsHttpContextBinding" contract="WFToHostInIIS.IProductOrder" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/service&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;behaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;serviceBehaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.5in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;behavior name="ServiceBehavior"&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;serviceMetadata httpGetEnabled="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;serviceDebug includeExceptionDetailInFaults="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;serviceCredentials&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 2.25in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;windowsAuthentication allowAnonymousLogons="false" includeWindowsGroups="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/serviceCredentials&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;!-- Comment out the following behavior to disable persistence store --&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;workflowRuntime name="WorkflowServiceHostRuntime" validateOnCreate="true" enablePerformanceCounters="true"&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 2.25in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 2.625in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionString="Data Source=localhost;Initial Catalog=NetFx35Samples_ServiceWorkflowStore;Integrated Security=True;Pooling=False" LoadIntervalSeconds="1" UnLoadOnIdle="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 2.25in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/services&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.875in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/workflowRuntime&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.5in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/behavior&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/serviceBehaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/behaviors&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;system.web&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;compilation&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;assemblies&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.5in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;add assembly="System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 1.125in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/assemblies&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/compilation&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;identity impersonate="false" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/system.web&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;system.webServer&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.75in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;directoryBrowse enabled="true" /&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in 0in 0in 0.375in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/system.webServer&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;3.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Save this file to&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; C:\IISHostForWorkflow.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;A couple of things to note regarding this web.config file:&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.375in; DIRECTION: ltr; FONT-FAMILY: Arial; unicode-bidi: embed" type=a&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I have added the OOB SQL Persistence service to this example. It is not necessary to do that, so you can remove it if you want. If you do use it and you're using SQLExpress, you need to change the Data Source setting.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This example also assumes you've installed and setup the .Net 3.5 Samples located at:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;&lt;SPAN style="FONT-WEIGHT: bold"&gt;Windows Communication Foundation (WCF), Windows Workflow Foundation (WF) and Windows CardSpace Samples&lt;/SPAN&gt;&lt;BR&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2611a6ff-fd2d-4f5b-a672-c002f1c09ccd&amp;amp;DisplayLang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2611a6ff-fd2d-4f5b-a672-c002f1c09ccd&amp;amp;DisplayLang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=2611a6ff-fd2d-4f5b-a672-c002f1c09ccd&amp;amp;DisplayLang=en&lt;/A&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.375in; DIRECTION: ltr; FONT-FAMILY: Arial; unicode-bidi: embed" type=a&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Notice that the service name points to the same name as the app.config file in our workflow project.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=3&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Notice that both endpoint contracts point to the IProductOrder contract.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=4&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Create a new file for the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;C:\IISHostForWorkflow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; directory named &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;OrderProcess.svc&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Do this within Visual Studio. I just started by creating a new text file and just renaming it.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=5&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;Paste in the following code:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;%@ServiceHost language=c# Debug="true" Service="WFToHostInIIS.OrderProcessWF" Factory="System.ServiceModel.Activation.WorkflowServiceHostFactory" %&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;Notice how the service that we are referencing here is our workflow.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=6&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Save the file.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=7&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Copy your workflow assembly file (from the projects bin\Debug directory) to your virtual directories Bin directory.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=8&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;To make sure that everything is working appropriately, open Internet Explorer and browse to:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;&lt;A href="http://localhost/IISWorkflowHost/OrderProcess.svc.&amp;nbsp;" mce_href="http://localhost/IISWorkflowHost/OrderProcess.svc.&amp;nbsp;"&gt;http://localhost/IISWorkflowHost/OrderProcess.svc.&amp;nbsp; &lt;/A&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;What you should see is a window similar to what you would see if you browsed to a web service location.&lt;/P&gt;
&lt;P style="MARGIN: 0in" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; FONT-FAMILY: Arial; TEXT-DECORATION: underline"&gt;Creating a Test Client&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0in; FONT-FAMILY: Arial; TEXT-DECORATION: underline" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Create a new Visual C# Windows Console Application named '&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;ConsoleServiceTest&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;' and place it in the&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; C:\TestWorkflowService&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; directory.&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Open a command prompt that will allow you to run svcutil.exe. I'm going to just open mine to the Windows SDK directory and run the command:&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial"&gt;&lt;SPAN style="COLOR: blue"&gt;Svcutil /config:app.config&lt;/SPAN&gt; &lt;A href="http://localhost/IISWorkflowHost/OrderProcess.svc" mce_href="http://localhost/IISWorkflowHost/OrderProcess.svc"&gt;http://localhost/IISWorkflowHost/OrderProcess.svc&lt;/A&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;Two files will be created in the directory where you are running svcutil from, an app.config file and an OrderProcessWF.cs file. Add these two files to your console app project. You could also just right click on the project and choose 'Add Service Reference' and find the service.&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=3&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Add a reference to &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;System.ServiceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; and &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;System.Runtime.Serialization&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; to the project.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=4&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Paste the following code into the &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Main&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; method in &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Program.cs&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;WFToHostInIIS.OrderInfo oInfo = new WFToHostInIIS.OrderInfo();&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;oInfo.FName = "John";&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;oInfo.LName = "Doe";&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;oInfo.OrderID = "1234";&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;try&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;ProductOrderClient client = new ProductOrderClient();&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;client.SubmitOrder(oInfo);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;catch (Exception e)&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine("Exception: {0}",e.Message);&lt;/P&gt;
&lt;P style="FONT-SIZE: 9pt; MARGIN: 0in; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=5&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;You can step through this using any method you want.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/OL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6960531" width="1" height="1"&gt;</description></item><item><title>New BizTalk Server Adapters site</title><link>http://blogs.msdn.com/ncdevguy/archive/2007/08/01/new-biztalk-server-adapters-site.aspx</link><pubDate>Thu, 02 Aug 2007 02:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4178224</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/4178224.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=4178224</wfw:commentRss><description>&lt;P&gt;Not sure if you've had the time to go out and view the new BizTalk Adapters site.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://msdn2.microsoft.com/en-us/biztalk/bb544997.aspx"&gt;&lt;FONT face=Calibri size=3&gt;http://msdn2.microsoft.com/en-us/biztalk/bb544997.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The new site includes a simplified categorization of the adapters, better organization, and some new adapter content. Very shortly this site will replace the old adapter site (&lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/biztalk/aa937652.aspx"&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;http://msdn2.microsoft.com/en-us/biztalk/aa937652.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;). &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Expect to see new links added for R2 when it releases.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4178224" width="1" height="1"&gt;</description></item><item><title>Book Review: Inside Microsoft Windows SharePoint Services 3.0</title><link>http://blogs.msdn.com/ncdevguy/archive/2007/06/15/book-review-inside-microsoft-windows-sharepoint-services-3-0.aspx</link><pubDate>Fri, 15 Jun 2007 15:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3312397</guid><dc:creator>larrywa</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/3312397.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=3312397</wfw:commentRss><description>&amp;nbsp; 
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial"&gt;I just recently began my journey down the road of learning about WSS and MOSS. My primary focus of course is for the workflow portion of the product, but what I have found while building that base of knowledge, is that you do need to know quite a bit about SharePoint just to be able to understand what you can do with custom workflows.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial"&gt;I picked up this book written by Ted Pattison and Daniel Larson and I've been very impressed with the content, the level of detail and code samples. I can see that this is a book I am going to reference again and again.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I was actually working with a client who had WSS questions the week I purchased this book and the answers were right there in front of me. Talk about good timing!&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial"&gt;This book is definitely for the developer but it does have topics and admin might be interested in like SharePoint architecture, deployment and application security.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;And of course the chapter on workflow was most excellent…the text was very clear at explaining several of the properties and fields that are critical pieces of custom workflows.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; COLOR: black; FONT-FAMILY: Arial"&gt;I'm not sure what those folks who have lots of experience with WSS think of the book, but for me, it was a good purchase.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3312397" width="1" height="1"&gt;</description></item><item><title>Versioning Techniques for Workflows</title><link>http://blogs.msdn.com/ncdevguy/archive/2007/06/14/versioning-techniques-for-workflows.aspx</link><pubDate>Fri, 15 Jun 2007 02:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3300183</guid><dc:creator>larrywa</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/ncdevguy/comments/3300183.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ncdevguy/commentrss.aspx?PostID=3300183</wfw:commentRss><description>&lt;TABLE class="" height="100%" cellSpacing=0 cellPadding=0 width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=ms-bodyareacell vAlign=top class="ms-bodyareacell"&gt;
&lt;TABLE class=ms-propertysheet id=MSO_ContentTable height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0 class="ms-propertysheet"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=ms-bodyareaframe vAlign=top height="100%" class="ms-bodyareaframe"&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=0 width="100%" border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" id=MSOZoneCell_WebPartWPQ2 vAlign=top&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=0 width="100%" border=0 TOPLEVEL&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top&gt;
&lt;DIV id=WebPartWPQ2 allowExport="false" WebPartID="4ed65f2d-48e6-4573-b641-b67c04abed2b" HasPers="false" width="100%" allowDelete="false"&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=0 width="100%" border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;
&lt;TABLE class=ms-disc id={D6C25FE4-9658-419A-AC8F-3F13456D37B2}-{4ED65F2D-48E6-4573-B641-B67C04ABED2B} dir=None cellSpacing=0 cellPadding=3 width="100%" summary="Dev Workshop Questions" border=0 class="ms-disc" mce_href="http://sharepoint/sites/DevWFSolutions/_vti_bin/owssvr.dll?CS=65001&amp;amp;XMLDATA=1&amp;amp;RowLimit=0&amp;amp;List={D6C25FE4-9658-419A-AC8F-3F13456D37B2}&amp;amp;View={4ED65F2D-48E6-4573-B641-B67C04ABED2B}" o:WebQuerySourcehref="http://sharepoint/sites/DevWFSolutions/_vti_bin/owssvr.dll?CS=65001&amp;amp;XMLDATA=1&amp;amp;RowLimit=0&amp;amp;List={D6C25FE4-9658-419A-AC8F-3F13456D37B2}&amp;amp;View={4ED65F2D-48E6-4573-B641-B67C04ABED2B}"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=ms-disc-bordered-noleft width="100%" class="ms-disc-bordered-noleft"&gt;
&lt;DIV class=ExternalClass03DEA12410E440D2B207F7C4BB7A7068&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;As of right now, there are no documents (whitepapers) available that pertain specifically to workflow versioning other than what you will find on MSDN at &lt;A href="http://msdn2.microsoft.com/En-US/library/aa349375.aspx" mce_href="http://msdn2.microsoft.com/En-US/library/aa349375.aspx"&gt;http://msdn2.microsoft.com/En-US/library/aa349375.aspx&lt;/A&gt;.&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;However, out on the forum &lt;A href="http://wf.netfx3.com/" mce_href="http://wf.netfx3.com/"&gt;http://wf.netfx3.com&lt;/A&gt;, there have been several posts related to versioning and to give you an executive summary of what you need to do, there are basically two ways (without doing lots of coding) to handle versioning:&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 11pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.375in; DIRECTION: ltr; FONT-FAMILY: Calibri; unicode-bidi: embed" type=1&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;Use workflows that execute based on XAML activitation.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;This is where you just read in a .xoml file via an XMLTextReader through the CreateWorkflow method.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;As I stated in class, there is no concept of versioning in a .xoml file and there is no concept of security reading the file in this way either, except for the fact that whoever puts the .xoml file on the machine where the host reads it from must have permissions to do so.&lt;/SPAN&gt; &lt;BR&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;Use .Net versioning techniques where you modify the version in the assembly.cs file prior to deploying it. This should allow in process workflows to continue/finish execution and new workflows to startup with the new workflow version.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;Here is a link to assembly versioning steps in .Net:&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/51ket42z(vs.71).aspx"&gt;http://msdn2.microsoft.com/en-us/library/51ket42z(vs.71).aspx&lt;/A&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri"&gt;So, that was the executive summary, but even within these two types of versioning tactics, there are some other things to consider:&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in 0in 0in 0.375in; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; FONT-SIZE: 11pt; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.375in; DIRECTION: ltr; FONT-FAMILY: Calibri; unicode-bidi: embed" type=a&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=1&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;Are you trying to modify the workflow object structure (ie. Add new dependency properties or methods) or are you trying to add/remove activities?&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If you only need to add/remove activities in certain workflow instances, you can still use the WorkflowChanges class to modify these at runtime.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If you are add/removing/changing properties etc of a workflow then you cannot expect a workflow that is currently persisted to be able to be reloaded into a new object structure.&lt;/SPAN&gt; &lt;BR&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=2&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;Are you going to be providing workflows or workflow apps to your customers or internal groups and then later wanting to enhance these workflows, without changing the one they have? If you need to do this, it might make more sense to come up with some sort of rules based workflow where you can modify the rules, storing the rules in a database such as we saw with the External Ruleset Demo tool. You can of course change the workflow and rules using the WorkflowChanges class but this only changes the workflow for that one running instance of the workflow, meaning that you would take a performance hit each time you ran the workflow because it would have to be modifying the running workflow instead of executing a compiled version.&lt;/SPAN&gt; &lt;BR&gt;
&lt;LI style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle" value=3&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;If you are going to be using XAML activation, are you going to be linking it to an activity class library? Without using some activity library, just using XAML activation is going to severely limit what you can do with your .xoml file. Since most business logic needs to take place in code, this will most likely mean the code will need to be in a custom activity, which will need to be linked inside of the .xoml file.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;So, essentially when you need to update the activity assembly you are once again looking at having to use .Net assembly versioning techniques. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri"&gt;&lt;SPAN style="COLOR: #4c4c4c"&gt;So, how does an persisted, unloaded workflow know which version of the assembly to use when it is reloaded?&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d"&gt;When the workflow gets serialized to the database serialized (binary), the assembly and type information gets serialized as well.&amp;nbsp; This is normal .NET serialization (BinaryFormatter), not anything workflow-specific.&amp;nbsp; Upon deserialization, &amp;nbsp;.NET will automatically load the correct assembly based on version (assuming the correct version of the assembly exists in the GAC or config and can be resolved).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; COLOR: #1f497d; FONT-FAMILY: Calibri" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; COLOR: #1f497d; FONT-FAMILY: Calibri"&gt;The workflow runtime actually knows nothing about workflow versions or any of that.&amp;nbsp; The instant we serialize a workflow, it’s no longer WF – it’s .NET from then on up to the point after the WF is deserialized again.&lt;/P&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;IMG alt="" src="http://sharepoint/_layouts/images/blank.gif" width=1 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&lt;IMG height=15 alt="" src="http://sharepoint/_layouts/images/blank.gif" width=1 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/PLACEHOLDER&gt;&lt;/TD&gt;
&lt;TD class=ms-rightareacell class="ms-rightareacell"&gt;
&lt;DIV class=ms-pagemargin&gt;&lt;IMG height=1 alt="" src="http://sharepoint/_layouts/images/blank.gif" width=10 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=ms-pagebottommarginleft class="ms-pagebottommarginleft"&gt;&lt;IMG height=10 alt="" src="http://sharepoint/_layouts/images/blank.gif" width=1 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/TD&gt;
&lt;TD class=ms-pagebottommargin class="ms-pagebottommargin"&gt;&lt;IMG height=10 alt="" src="http://sharepoint/_layouts/images/blank.gif" width=1 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/TD&gt;
&lt;TD class=ms-bodyareapagemargin class="ms-bodyareapagemargin"&gt;&lt;IMG height=10 alt="" src="http://sharepoint/_layouts/images/blank.gif" width=1 mce_src="http://sharepoint/_layouts/images/blank.gif"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3300183" width="1" height="1"&gt;</description></item></channel></rss>