Click here to Skip to main content
12,688,944 members (32,199 online)

WCF Net Tcp Socket Connection Was Aborted Error - HELP

RonnieDean77 asked:

Open original thread
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">	
   <messageLogging logEntireMessage="true" logMalformedMessages="true"
    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
Tags: C#, WCF


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web02 | 2.8.170113.4 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
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