Create WF4 service host in code (CSWF4ServiceHostFactory)

The code sample demonstrates creating a WF4 service host in code by using the WorkflowServiceHost class.

C# (48.1 KB)
1 Star
9,176 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • I am unable to run this.
    3 Posts | Last post November 04, 2011
    • Everytime I try to run this I receive the below error
      Error: Cannot obtain Metadata from http://localhost:44864/Service1.xamlx If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at Exchange Error    URI: http://localhost:44864/Service1.xamlx    Metadata contains a reference that cannot be resolved: 'http://localhost:44864/Service1.xamlx'.    The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.HTTP GET Error    URI: http://localhost:44864/Service1.xamlx    There was an error downloading 'http://localhost:44864/Service1.xamlx'.    The request failed with the error message:--<html>    <head>        <title>The type 'CSWF4ServiceHostFactory.MyServiceHostFactory', provided as the Factory attribute value in the 'system.serviceModel/serviceHostingEnvironment/serviceActivations' section in configuration file could not be found.
    • Here are some tips for you to get this sample running up. 
      1. Please deploy this sample in IIS7/7.5. ("Add a Application" in IIS7, .Net Framework 4.0).
      2. If you still not able to run this sample, add a bin folder in the project folder and copy CSWF4ServiceHostFactory.dll file to bin folder.
      3. if you have any permission problem, you can change the identity of Application Pool to LocalSystem or Administrator account. so that this service can access to web.config file and database. 
    • Sample code updated