2012-12-05 51 views
2

我正在嘗試將workflowControlEndpoint添加到我的IIS託管的XAMLX服務。我無法從客戶端引用控制端點,但我仍然收到以下錯誤WF 4.0將WorkflowControlEndPoint添加到IIS託管的XAMLX服務

請求失敗,HTTP狀態404:未找到。 元數據包含無法解析的引用:'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> 

回答

0

我試圖讓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,然後運行控制檯應用程序以取消工作流。

0

進入 「控制面板>程序和功能>打開Windows功能打開或關閉」,並檢查下列功能檢查:

  • .NET Framework 3.5的
  • 的.NET Framework 4.5高級服務> WCF服務