1
votes

I have a wcf service that needs to implement callbacks and be hosted on IIS 6.0. Since IIS 6.0 doesn't support the net.tcp binding, I decided to use a custom binding because the service is accessed by different clients in different timezones and, using custom binding, I can set the allowed clock skew time to values other than the default one.

Here is my server config file:

<bindings>
  <customBinding>        
    <binding name="pscNetBinding" openTimeout="00:10:00">          
      <reliableSession acknowledgementInterval="00:00:00.2000000"
  flowControlEnabled="true" inactivityTimeout="23:59:59"
  maxPendingChannels="128" maxRetryCount="8" maxTransferWindowSize="128"
  ordered="true" />
      <compositeDuplex />
      <oneWay maxAcceptedChannels="128" packetRoutable="false">
        <channelPoolSettings idleTimeout="00:10:00"
  leaseTimeout="00:10:00" maxOutboundChannelsPerEndpoint="10" />
      </oneWay>
      <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
  messageVersion="Default" writeEncoding="utf-8">
        <readerQuotas maxDepth="2147483647"
  maxStringContentLength="2147483647" maxArrayLength="2147483647"
  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </textMessageEncoding>
      <httpTransport manualAddressing="false"
  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
  allowCookies="false" authenticationScheme="Anonymous"
  bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
  keepAliveEnabled="true" maxBufferSize="2147483647"
  proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered"
  unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true"/>
    </binding>
  </customBinding>
</bindings>

<services>
  <service name="SchneiderElectric.PSCNet.Server.Services.PSCNetWCFService" behaviorConfiguration="Behaviors1">
    <host>
      <baseAddresses>
        <add baseAddress ="http://10.155.18.18:2000/PSCNet"/>
      </baseAddresses>
    </host>
    <endpoint address="" binding="customBinding"    bindingConfiguration="pscNetBinding"
                                contract="SchneiderElectric.PSCNet.Server.Contracts.IPSCNetWCFService"/>
  </service>
</services>    
<behaviors>
  <serviceBehaviors>
    <behavior name="Behaviors1">
      <serviceMetadata httpGetEnabled = "true"/>
      <!--<serviceThrottling maxConcurrentCalls="2048" maxConcurrentSessions="2048" maxConcurrentInstances="2048" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />-->
    </behavior>
  </serviceBehaviors>
</behaviors>

Client config file:

  <bindings>
    <customBinding>
      <binding name="pscNetBinding" openTimeout="00:10:00">            
        <reliableSession acknowledgementInterval="00:00:00.2000000"
    flowControlEnabled="true" inactivityTimeout="23:59:59"
    maxPendingChannels="128" maxRetryCount="8" maxTransferWindowSize="128"
    ordered="true" />
        <compositeDuplex />
        <oneWay maxAcceptedChannels="128" packetRoutable="false">
          <channelPoolSettings idleTimeout="00:10:00"
    leaseTimeout="00:10:00" maxOutboundChannelsPerEndpoint="10" />
        </oneWay>
        <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
    messageVersion="Default" writeEncoding="utf-8" >
          <readerQuotas maxDepth="2147483647"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </textMessageEncoding >
        <httpTransport manualAddressing="false"
    maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
    allowCookies="false" authenticationScheme="Anonymous"
    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    keepAliveEnabled="true" maxBufferSize="2147483647"
    proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered"
    unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />                    
      </binding>
    </customBinding>
  </bindings>
  <client>
    <endpoint address="http://10.155.18.18:2000/PSCNet" binding="customBinding"
        bindingConfiguration="pscNetBinding" contract="PSCNetWCFService.IPSCNetWCFService"
        name="pscNetBinding" />
  </client>

If I use the server and client on the same machine, everything works fine. If I run them on different machines, I get the following error:

Could not connect to http://10.155.18.198:9000/e60ba5b3-f979-4922-b9f8-c820caaa04c2. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.155.18.198:9000.

Can anyone in the community help me in this regard?

2

2 Answers

1
votes

Can you show the part of the config where you're defining the customBinding? Maybe you just didn't paste that part in, but when you define a custom binding, you have to specify an encoding and a transport at minimum - something like this:

<bindings>
    <customBinding>
        <binding name="MyCustomTextTcpBinding">
            <textMessageEncoding />
            <tcpTransport />
        </binding>
    </customBinding>
</bindings>

Can you also paste in the part where you're defining your "pscNetBinding" bindingConfiguration?

-1
votes

Windows service is undoubtely a nice solution but i think a better would be a self hosting and you could have anytype of binding on it.