2

IIS がホストする XAMLX サービスに workflowControlEndpoint を追加しようとしています。クライアントからコントロール エンドポイントを参照できません。次のエラーが発生し続けます。

リクエストは HTTP ステータス 404: Not Found で失敗しました。メタデータに解決できない参照が含まれています: 'http://localhost/Test.xamlx/wce'。コンテンツ タイプ application/soap+xml; charset=utf-8 は、サービス 'http://mymachine/Test.xamlx/wce' でサポートされていませんでした。クライアントとサービスのバインディングが一致していない可能性があります。リモート サーバーがエラーを返しました: (415) コンテンツ タイプが 'application/soap+xml; であるため、メッセージを処理できません。charset=utf-8' は予期されたタイプの 'text/xml ではありませんでした。charset=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>
4

2 に答える 2

1

IWorkflowInstanceManagement を WCF テスト クライアント経由で動作させようとしましたが、メタデータを見つけることができませんでした。そのため、コードを介して通信しようとしました。それは私のために働いた。

新しいワークフロー サービス プロジェクトを作成すると、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 を取得し、コンソール アプリを実行してワークフローをキャンセルすることができました。

于 2013-03-13T17:16:14.333 に答える