Note that there are some explanatory texts on larger screens.

plurals
  1. POHosting Workflows with WorkflowServiceHost
    primarykey
    data
    text
    <p>Ok, so I may be approaching this incorrectly but essentially I'm trying to play with new WF services in 4.0 to build up to a Windows service that hosts a WF service. At the moment I have constructed client (containing a simple Activity XAML) and service (WF service implemented in a XAMLX file) projects.</p> <p>I have tried simple "hello worlds" for each one. The client has been hosted in a <code>WorkflowApplication</code> and I initially setup the service as the default WF service project template. Both seem to be fine there. </p> <p>Since I want to host a service without IIS, naturally my next attempt was to host my service in a <code>WorkflowServiceHost</code>. Doing this I can use <code>XamlServices.Load()</code> and pass the object it returns to the <code>WorkflowServiceHost</code> constructor along with a URI for the endpoint. I was concerned because that there is no <code>Run()</code> member method like there is in the <code>WorkflowApplication</code> class. I assumed that the <code>Open()</code> method would open the service host object as a service and that it would start an instance of the workflow but there is no indication of it.</p> <p>At first I setup the service workflow to simply write to a text file when it started but nothing happened. I tried to debug with breakpoints but since it is loading a XAMLX file at runtime, VS doesn't allow me to debug the WF. So I tried altering the client project a bit to use a <code>WorkflowServiceHost</code> instead of a <code>WorkflowApplication</code>. I used the same workflow used to test out the hello world style workflow and this time there was no output to console and the <code>WorkflowApplication</code> was successful with that previously.</p> <p>Here's the very basics of what I did with the client to host the workflow service in the console project. If anyone wants to see the XAML for the workflow let me know and I'll update this question. Here's the hosting code in <code>Main()</code>.</p> <pre><code>const String clientAddress = "http://localhost:9998/Client"; WorkflowServiceHost wfHost = new WorkflowServiceHost( new ClientWf(), new Uri(clientAddress) ); wfHost.Open(); while( Console.ReadKey().KeyChar.ToString().ToUpper() != "X" ) { } wfHost.Close(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload