Search code examples
iis-7workflow-foundation-4

How to host workflow service (.xamlx) with net.tcp binding on IIS 7.0?


I am hosting Workflow service on iis 7.0 with net.tcp binding. My config file like as

<?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="[email protected]"/>
    <add key="FromAddress" value="[email protected]"/>
    <add key="SMTPUserName" value="[email protected]"/>
    <add key="SMTPPassword" value ="[email protected]"/>
  </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>

Now my issue is i am unable to generate proxy through net.tcp binding but i can generate it through http. http://testsrv.com/RewindService/RewindTest.xamlx?wsdl. then i am unable to call receive operation method. Although it is workking fine with local console Host.


Solution

  • As we know that workflow service is similar to wcf service. So I decided to reconsider my deployment steps. I found a very good link about it and follow and check each and every step carefully and able to resolved my problem.

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

    My configuration is ok and updated the tcp port no. it works like a charm.