3
votes

My WCF service works fine with Security Mode="Transport" and clientCredentialType="Windows" (with client and service on either one machine or two). But I need to put the service on the other side of a firewall where Windows Authentication is not possible. I know I can either install X.509 certs or use security="None" (to which I would add my own security protocol). But I cannot get "None" to work! I keep getting 'The socket connection was aborted' error.

Here is the config, please let me know if you spot anything. I have tried it without the 2 lines that specify clientCredentialType="none" but it makes no diff. P.S. Each time I make a config change I stop and restart both the client and the service.

SERVER CONFIG

<system.serviceModel>  
<services>  
  <service name="OuterService.OutCardTrx">  
      <endpoint address="" binding="netTcpBinding" contract="OuterService.IOutCardTrx">  
          <identity>  
          <dns value="localhost"/>  
          </identity>  
      </endpoint>  
      <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      <host>  
        <baseAddresses>  
          <add baseAddress="net.tcp://jimt4.campus.internal:8081/PCIOutService"/>  
        </baseAddresses>  
        </host>
  </service>
</services>
<bindings>
  <netTcpBinding>
    <binding name="netTcpBinding">
      <security mode="None" >
        <transport clientCredentialType="None" />
        <message clientCredentialType="None" />
      </security>
    </binding>
  </netTcpBinding> 
</bindings>

CLIENT CONFIG:

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_IOutCardTrx" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
          hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
          maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
              <transport clientCredentialType="None" />
              <message clientCredentialType="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="net.tcp://jimt4.campus.internal:8081/" binding="netTcpBinding"
           bindingConfiguration="NetTcpBinding_IOutCardTrx" contract="OCS.IOutCardTrx"
           name="NetTcpBinding_IOutCardTrx">
           <identity>
              <dns value="localhost" />
           </identity>
         </endpoint>
     </client>
    </system.serviceModel>
2
How are you hosting your service (IIS or Self-Hosting)? Also, you can remove the clientCredentialType settings. They aren't used when security mode is none.Rick Rainey
@user1185782 Is it possible to use http binding?Alex

2 Answers

4
votes

Not 100% sure this is the reason, but your binding security settings don't match between the client and the service.

Note that the default security for NetTcpBinding is Transport (for mode). You define None in your binding in the service config, but that binding is never assigned to the service endpoint, so your service is using the default settings for NetTcp.

On the other hand, you are setting the binding configuration on your client.

Try setting the binding configuration in your service endpoint like this:

<endpoint address="" binding="netTcpBinding" 
          bindingConfiguration="netTcpBinding"
          contract="OuterService.IOutCardTrx"> 

This will assign your specified binding to the endpoint, with security set to "None". I would also recommend changing the binding configuration name to something other than "netTcpBinding" to avoid any possible confusion.

0
votes

Did you try increasing the values for MaxItemsInObjectGraph, MaxReceivedMessageSize, MaxBufferPoolSize, MaxBufferSize, MaxArrayLength in both client/server configs? The default values are pretty low, try maxing them out to 2147483647.

Also try enabling tracing on the service to see further error details.