Workflow Service application - IIS hosting

Today - we are going to talk about hosting workflow service application on IIS.
 
Recently, I came across a case where customer wanted to host the workflow service application on IIS with windows authentication enabled. We need to ensure we follow the inherited concepts of WCF service application configuration and hosting.
 
Create workflow service application

  1. Open Visual studio 2013 (or your version of visual studio)
  2. Create new solution
  3. Select Workflow Service Application project template
  4. Name the project as WorkflowService1
  5. Select Service1.xamlx
  6. Right click > View code

1
 

  1. Keep a note of Name value – it would be utilized in the service application endpoint configuration
  2. Go to Service1.xamlx and select ReceiveRequest

2
 

  1. As highlighted, IService is the service contract over here with GetData as the operation contract. It could also be your respective project specific names as well.
  2. Select Service1.xamlx and it should have following properties

  3
 

  1. Ensure that custom tool must be select to MSBuild:Compile value. It would ensure that the workflow service component would be available as part of the implemented assembly.
  2. Now – select SendResponse of Service1.xamlx
  3. Click on View message… of Content row
  4. Modify your message data

4
 

  1. Go to web.config

 

 
    <system.serviceModel>
            <services>
                    <service name="Service1" behaviorConfiguration="behavior1">
                           <endpoint address=""
                                        binding="basicHttpBinding" bindingConfiguration="secured"
                                        contract="IService"
                                        name="mySerivceEP"
                           />
                    </service>
            </services>
            <behaviors>
                    <serviceBehaviors>
                           <behavior name="behavior1">
                                    <serviceMetadata httpsGetEnabled="true"/>
                                    <serviceDebug includeExceptionDetailInFaults="true"/>
                           </behavior>
                    </serviceBehaviors>
            </behaviors>
            <bindings>
                    <basicHttpBinding>
                            <binding name="secured">
                                    <security mode="Transport">
                                            <transport clientCredentialType="Windows"/>
                                    </security>
                            </binding>
                    </basicHttpBinding>
           </bindings>
     </system.serviceModel>

 

  1. Build the project

 

Publish

  1. Publish the application to IIS (you can follow your own method)
  2. Right click WorkflowService1 project and go to Properties
  3. Go to Web tab and update like the following:

5
 
IIS configuration

  1. Go to IIS manager and the respective virtual directory
  2. Go to Features view
  3. Select Authentication under IIS
  4. Ensure only Windows authentication is selected as you are trying enforce windows authentication
  5. Disable the default Anonymous authentication

 

To confirm

  1. Browse the service component or wsdl
  2. You should be able to browse it

 

How to test

  1. Go to Visual studio Developer command prompt
  2. Open wcftestclient.exe
  3. Click Add service from menu
  4. Provide the workflow service wsdl in it
  5. Hit OK

6

  1. Click on method and test

7

 

 

 

I hope this helps - Happy Coding!!!