WF 4.0将WorkflowControlEndPoint添加到IIS托管的XAMLX服务

时间:2012-12-05 16:43:38

标签: workflow-foundation-4

我正在尝试将workflowControlEndpoint添加到我的IIS托管XAMLX服务。我无法从客户端引用控制端点,我不断收到以下错误

请求失败,HTTP状态为404:Not Found。 元数据包含无法解析的引用:'http://localhost/Test.xamlx/wce'。 内容类型application / soap + xml;服务'http://mymachine/Test.xamlx/wce'不支持charset = utf-8。客户端和服务绑定可能不匹配。 远程服务器返回错误:(415)无法处理消息,因为内容类型为'application / soap + xml; charset = utf-8'不是预期的类型'text / xml;字符集= UTF-8' ..

我有以下web.config。有人能指出我错过了什么吗?谢谢,感谢帮助......

<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>

2 个答案:

答案 0 :(得分:0)

我试图让IWorkflowInstanceManagement通过WCF测试客户端工作,但我从来没有找到它来查找元数据。所以我只是尝试通过代码与它进行通信。它对我有用。

我创建了一个新的Workflow Service项目,我的web.config看起来像这样:

<?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>

然后我使用以下代码创建了一个控制台应用程序(我知道这不是使用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"));

我的工作流程只是在一个运行延迟几分钟的循环中运行。我能够通过WCF测试客户端启动工作流实例,然后从持久性数据库中获取工作流实例ID,然后运行控制台应用程序以取消工作流。

答案 1 :(得分:0)

转到“控制面板&gt;程序和功能&gt;打开或关闭Windows功能”,然后检查是否选中了以下功能:

  • .NET Framework 3.5
  • .NET Framework 4.5高级服务&gt; WCF服务