Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF
Wow, I have been banging my head against the wall for about 5+ days now. I have a WCF Service Application (Windows Services hosted), using net.tcp binding with Windows Authentication, running on a remote server. I created a test Windows client, added a service reference to my IDataService, then created a ChannelFactory for my proxy. When calling the service I receive an error "The socket connection was aborted..."
 

Any suggestions on what I have done wrong here?
 

Here is my Win code call (this is only test code):
 
// These setting are exactly as the web.config in the IDataService.
NetTcpBinding binding = new NetTcpBinding() ;
binding.TransactionFlow = false;
binding.PortSharingEnabled = true;
binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
binding.Security.Mode = SecurityMode.None;
binding.ReceiveTimeout = TimeSpan.MaxValue;
        
var endPointAddress = new EndpointAddress(new Uri("net.tcp://SOMESERVER:9000/OperationsDataService.DataService.svc"), new SpnEndpointIdentity("MYSERVICE/MyMachine"));
 
var proxy = ChannelFactory<idataservice>.CreateChannel(binding, endPointAddress);
 
// SpParameter is a [DataContract] class in the WCF interface service that has a few [DataMembers].
SpParameter[] spParams = new SpParameter[1];
spParams[0] = new SpParameter();
spParams[0].Paraname = @"@Commodity";
spParams[0].Paratype = @"char(1)";
spParams[0].Paravalue = @"'P'";
 
// The proxy method returns a [DataContract] called ReturnResults which is basically a DataSet.  This DataSet gets added into the grid cntrol.
dataGridViewReturn.DataSource = proxy.ExecuteStoredProcedure("PowerTrading_Dev_I", "", spParams, true);
 
My web.config:
<pre lang="HTML">	
<system.serviceModel>
		<diagnostics>
   <messageLogging logEntireMessage="true" logMalformedMessages="true"
    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
  </diagnostics>
  <bindings>
   <netTcpBinding>
    <binding name="netTcpBinding" maxBufferPoolSize="10000000" maxBufferSize="10000000"
     maxConnections="100" maxReceivedMessageSize="10000000" portSharingEnabled="true">
     <readerQuotas maxDepth="255000" maxStringContentLength="255000"
      maxArrayLength="255000" maxBytesPerRead="255000" maxNameTableCharCount="255000" />
     <security mode="None">
      <message clientCredentialType="Windows" />
     </security>
    </binding>
   </netTcpBinding>
  </bindings>
		<services>
   <service behaviorConfiguration="OperationsDataService.DataServiceBehavior"
    name="OperationsDataService.DataService">
    <endpoint address="" behaviorConfiguration="ImpersonationBehavior"
     binding="netTcpBinding" bindingConfiguration="netTcpBinding"
     name="NetTcpEndpoint" contract="OperationsDataService.IDataService">
     <identity>
      <servicePrincipalName value="MYSERVICE/MyMachine" />
      <dns value="SOMESERVER" />
     </identity>
    </endpoint>
    <endpoint address="net.tcp://SOMESERVER:9000/mex" binding="mexTcpBinding"
     bindingConfiguration="" name="MexTcpEndPoint" contract="System.ServiceModel.Description.IMetadataExchange" />
    <host>
     <baseAddresses>
      <add baseAddress="net.tcp://SOMESERVER:9000/OperationsDataService.DataService.svc" />
     </baseAddresses>
    </host>
   </service>
  </services>
		<behaviors>
   <endpointBehaviors>
    <behavior name="ImpersonationBehavior">
     <clientCredentials>
      <windows allowedImpersonationLevel="Impersonation" />
      <httpDigest impersonationLevel="Impersonation" />
     </clientCredentials>
     <callbackDebug />
    </behavior>
   </endpointBehaviors>
   <serviceBehaviors>
    <behavior name="OperationsDataService.DataServiceBehavior">
     <serviceMetadata httpGetEnabled="false" />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
	</system.serviceModel>
Posted 15-Jan-13 6:16am
Edited 15-Jan-13 8:15am
v8
Comments
Jason Gleim at 15-Jan-13 14:50pm
   
Do you have access to the WCF service & associated source code? Are you able to debug both sides of the call? (I ask because I'm wondering if there is an unhandled exception in the service which may be causing the abort.)
 
Also, have you tried WCF Storm or WireShark to manually test the call and/or sniff the traffic in-flight to see if you can get an idea of where it might be failing?
 
I would start with WCF Storm and try making the WCF service call to see if that part of the equation is even working. At least you cut in half the locations where the problem can be.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are most likely getting a size limit on your data.
 
Try adding the dataContractSerializer service behaviour:
 
<servicebehaviors>
 <behavior>
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
          ....
        </behavior>
...
</servicebehaviors>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 435
1 Sergey Alexandrovich Kryukov 200
2 Yogesh Kumar Tyagi 180
3 Richard Deeming 180
4 RyanDev 115
0 Sergey Alexandrovich Kryukov 6,405
1 OriginalGriff 5,798
2 CPallini 2,473
3 Richard MacCutchan 1,647
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100