Vasu Balakrishnan
Vasu Balakrishnan

Reputation: 1771

WF 4.0 adding WorkflowControlEndPoint to IIS hosted XAMLX service

I'm trying to add workflowControlEndpoint to my IIS hosted XAMLX service. I cannot reference the control endpoint from client, I keep getting the following error

The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http://localhost/Test.xamlx/wce'. Content Type application/soap+xml; charset=utf-8 was not supported by service 'http://mymachine/Test.xamlx/wce'. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..

I've the following web.config. Could someone point to me what I'm missing? Thanks and appreciate the help....

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior>
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
   <basicHttpBinding>
    <binding closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" transferMode="StreamedResponse">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
      </security>
    </binding>
    <binding name="httpSecurityOff" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647"
             allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
             transferMode="Streamed" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>
    </binding>
  </basicHttpBinding>
  <service name="Test">
    <endpoint address="" binding="basicHttpBinding" contract="IService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <endpoint address="wce" binding="basicHttpBinding"
              bindingConfiguration="httpSecurityOff" 
              contract="System.ServiceModel.Activities.IWorkflowInstanceMangement"
              kind="workflowControlEndpoint" />
  </service>

Upvotes: 2

Views: 1733

Answers (2)

Andr&#233; Leal
Andr&#233; Leal

Reputation: 186

Go to "Control Panel > Programs and Features > Turn Windows Features on or off" and check if following features are checked:

  • .NET Framework 3.5
  • .NET Framework 4.5 Advanced Services > WCF Services

Upvotes: 0

Mas
Mas

Reputation: 4606

I was trying to get the IWorkflowInstanceManagement to work via the WCF Test Client, but I never could get it to find the metadata. So I just tried to communicate with it via code. It worked for me.

I created a new Workflow Service project, and my web.config looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=localhost\SQLEXPRESS;Initial Catalog=WFS;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.serviceModel>

    <behaviors>
      <serviceBehaviors>
        <behavior name="workflowBehavior">
          <serviceMetadata httpGetEnabled="True" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll" 
                                    instanceEncodingOption="GZip" 
                                    instanceLockedExceptionAction="BasicRetry" 
                                    connectionStringName="ApplicationServices" 
                                    hostLockRenewalPeriod="00:00:20" 
                                    runnableInstancesDetectionPeriod="00:00:05" />
          <workflowInstanceManagement authorizedWindowsGroup="AS_Administrators" />
          <workflowUnhandledException action="Terminate" />
          <workflowIdle timeToPersist="00:01:00" timeToUnload="00:01:00" />
        </behavior>

        <behavior name="wceBehavior">
          <serviceMetadata httpGetEnabled="True" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>

    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

    <services>
      <service name="Service1" behaviorConfiguration="workflowBehavior">
        <endpoint binding="basicHttpBinding" address="" contract="IService" />
        <endpoint binding="basicHttpBinding" address="wce" kind="workflowControlEndpoint" />
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

Then I created a console app with the following code (I know this is not the best way to use ChannelFactory):

var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
var channelFactory = new ChannelFactory<IWorkflowInstanceManagement>(binding);
var channel = channelFactory.CreateChannel(new EndpointAddress("http://localhost/WorkflowControlTest/Service1.xamlx/wce"));
channel.Cancel(new Guid("DE212DE0-6BFF-4096-BF30-F6ACB2923B50"));

My workflow just runs in a loop running a delay for a few minutes. I was able to start a workflow instance via the WCF Test Client, then grab the Workflow Instance ID from the persistence database, and then run the console app to cancel the workflow.

Upvotes: 1

Related Questions