Workflow Application: How to configure a WCF Service workflow application for IIS Basic Authentication

Presentation

This article will show how to configure a WCF Service client and server for IIS Basic authentication.

This is the second part of the Workflow Application: How to use a WCF Service as a workflow application with basicHttpBinding or wsHttpBinding FAQ.

We’ll assume that the WorkflowAppWCFSample web site/app and the workflow application (including the client proxy .NET DLL) have been created, configured and function properly in Anonymous authentication.

1. WCF Service web site/app configuration

Edit the WorkflowAppWCFSample web.config and replace the complete <system.serviceModel> node with the following:

<system.serviceModel>
    <bindings> 
        <basicHttpBinding> 
            <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="104857600" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="104857600" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="TransportCredentialOnly"> 
                    <transport clientCredentialType="Basic"/> 
                </security> 
            </binding> 
    </basicHttpBinding>
</bindings> 
<services>
    <service name="WorkflowAppWCFSample.Service" behaviorConfiguration="ServiceBehavior"> 
        <endpoint address="" binding="basicHttpBinding" contract="WorkflowAppWCFSample.IService" bindingConfiguration="BasicHttpBinding_IService"> </endpoint> 
    </service>
</services>
    <behaviors> 
        <serviceBehaviors> 
            <behavior name="ServiceBehavior"> 
                <serviceMetadata httpGetEnabled="true"/> 
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior> 
        </serviceBehaviors> 
    </behaviors>
</system.serviceModel>

In IIS, set the WorkflowAppWCFSample website/app (http://localhost/wfgen/WfApps/WebServices/WorkflowAppWCFSample) to Basic authentication.

You need to disable Anonymous authentication if it’s still enabled.

2. WorkflowGen configuration for the WCF Service client proxy

Edit the WorkflowGen web.config and replace the complete <system.serviceModel> node with the following:

<system.serviceModel> 
    <bindings> 
        <basicHttpBinding> 
            <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="104857600" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="104857600" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="TransportCredentialOnly"> 
                    <transport clientCredentialType="Basic"/> 
                </security>
            </binding> 
        </basicHttpBinding> 
    </bindings> 
    <client> 
        <endpoint address="http://localhost/wfgen/WfApps/WebServices/WorkflowAppWCFSample/Service.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="WorkflowAppWCFSampleTest.IService" name="BasicHttpBinding_IService">
        </endpoint>
    </client>
</system.serviceModel>

On the Applications screen in the the WorkflowGen Administration Module:

For each WCF Service workflow application created based on one of the WorkflowAppWCFSample methods, specify a username and a password of a local or domain service account (e.g. wfgen_admin).