3

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>
4

2 回答 2

4

不是 100% 确定这是原因,但是您的绑定安全设置在客户端和服务之间不匹配。

请注意,NetTcpBinding 的默认安全性是Transport(对于模式)。您在服务配置中的绑定中定义None,但该绑定从未分配给服务端点,因此您的服务使用 NetTcp 的默认设置。

另一方面,您正在客户端上设置绑定配置。

尝试在您的服务端点中设置绑定配置,如下所示:

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

这会将您指定的绑定分配给端点,并将安全设置为“无”。我还建议将绑定配置名称更改为“netTcpBinding”以外的名称,以避免任何可能的混淆。

于 2013-09-05T06:41:01.327 回答
0

您是否尝试在客户端/服务器配置中增加 MaxItemsInObjectGraph、MaxReceivedMessageSize、MaxBufferPoolSize、MaxBufferSize、MaxArrayLength 的值?默认值非常低,尝试将它们最大化到 2147483647。

还可以尝试在服务上启用跟踪以查看更多错误详细信息。

于 2013-09-04T20:16:47.247 回答