如何在IIS 7.0上使用net.tcp绑定托管工作流服务(.xamlx)?

时间:2012-05-17 06:29:38

标签: iis-7 workflow-foundation-4

我正在使用net.tcp绑定在iis 7.0上托管Workflow服务。我的配置文件如

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <appSettings>
    <add key="SMTPAddress" value="000.00.0.00"/>
    <add key="ToAddress" value="abc@abc.com"/>
    <add key="FromAddress" value="abc@abc.com"/>
    <add key="SMTPUserName" value="abc@abc.com"/>
    <add key="SMTPPassword" value ="abc@abc.com"/>
  </appSettings>
  <connectionStrings>
       <add name="RewindConnectionString" connectionString="Data Source=xxx;User Id=xxx;Password=xxx;Connection Timeout=5" providerName="Oracle.DataAccess.Client" />

  </connectionStrings>
  <system.serviceModel>
    <tracking>
      <profiles>
        <trackingProfile name="Sample Tracking Profile">
          <workflow activityDefinitionId="*">
            <workflowInstanceQueries>
              <workflowInstanceQuery>
                <states>
                  <state name="*"/>
                </states>
              </workflowInstanceQuery>
            </workflowInstanceQueries>
            <activityStateQueries>
              <activityStateQuery activityName="*">
                <states>
                  <state name="*"/>
                </states>
                <variables>
                  <variable name="*"/>
                </variables>
              </activityStateQuery>
            </activityStateQueries>
            <activityScheduledQueries>
              <activityScheduledQuery activityName="*" childActivityName="*"/>
            </activityScheduledQueries>
            <faultPropagationQueries>
              <faultPropagationQuery faultSourceActivityName="*" faultHandlerActivityName="*"/>
            </faultPropagationQueries>
            <customTrackingQueries>
              <customTrackingQuery name="*" activityName="*"/>
            </customTrackingQueries>
          </workflow>
        </trackingProfile>
      </profiles>
    </tracking>
    <services>
      <service name="RewindTest" behaviorConfiguration="RewindTest_Behavior">
        <endpoint address="RewindTest"
        binding="netTcpBinding" contract="IRewindTestService" name="RewindTestNetTcpEndPoint" bindingConfiguration="RewindTestBinding" />

        <endpoint address="wce"
        binding="netTcpBinding" kind="workflowControlEndpoint" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9095/Service.Workflow.RewindTest/RewindTest" />
          </baseAddresses>
        </host>
        <endpoint address="mex"
            binding="mexTcpBinding"
            name="MEX"
            contract="IMetadataExchange" />
      </service>

    </services>
    <bindings>
      <netTcpBinding>
        <binding portSharingEnabled="true" name="RewindTestBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
                 sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>    
    <standardEndpoints>
      <workflowControlEndpoint>
        <standardEndpoint/>
      </workflowControlEndpoint>
    </standardEndpoints>
    <extensions>
      <behaviorExtensions>
        <add name="oracleInstanceStore" type="Devart.Data.Oracle.Activities.Configuration.OracleInstanceStoreElement, Devart.Data.Oracle.WorkflowFoundation" />
        <add name="oracleTracking" type="Devart.Data.Oracle.Activities.Configuration.OracleTrackingElement, Devart.Data.Oracle.WorkflowFoundation" />
      </behaviorExtensions>
    </extensions>
    <behaviors>
      <serviceBehaviors>
        <behavior name="RewindTest_Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="false"/>

          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>

          <oracleTracking
                        connectionString="User Id=xxx;Password=xxx;Server=xxx;"
                        profileName="Sample Tracking Profile" />

          <oracleInstanceStore
             connectionString="User Id=xxx;Password=xxx;Server=xxx;"
             instanceEncodingOption="None"
             instanceCompletionAction="DeleteNothing"
             instanceLockedExceptionAction="NoRetry"
             hostLockRenewalPeriod="00:00:30"
             runnableInstancesDetectionPeriod="00:00:05" />
          <workflowIdle timeToUnload="0"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

现在我的问题是我无法通过net.tcp绑定生成代理,但我可以通过http生成它。 http://testsrv.com/RewindService/RewindTest.xamlx?wsdl。然后我无法调用接收操作方法。虽然使用本地控制台主机可以正常工作。

1 个答案:

答案 0 :(得分:1)

我们知道工作流服务类似于wcf服务。所以我决定重新考虑我的部署步骤。我发现了一个很好的链接,并仔细检查每一步,并能够解决我的问题。

http://galratner.com/blogs/net/archive/2010/10/08/setting-up-a-nettcpbinding-enabled-wcf-service-in-iis-7.aspx

我的配置正常,并更新了tcp端口号。它就像一个魅力。