Search code examples
c#wcfsocketswindows-serviceswcfserviceclient

The socket connection was aborted while consuming wcf service in windows service


I created wcf service library with duplex communication and hosting using windows service, and one more project for clinet i.e, inside windows service I added wcf service reference and trying to consume service. when I try to call wcf service callback method I m getting "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9390000'".

This error I m getting when I try to consume wcf service from remote system within the network.From same sytem I am able to access the service callback flow.

I tried increasing service timeout and MaxBufferSize, MaxBufferPoolSize, MaxReceivedMessageSize, MaxArrayLength sizes also, but no luck. Icreated sample service and client n uploaded in below link.

Sample Applications link

App1 :- WCFService(winhosting).zip: consists of two pojects one is wcf service library project with callbacks and second project is windows service to hosting wcf service

App2 :- WCFClient(WinService) (2).zip : consists of one project i.e, windows service added wcf service reference here.


Solution

  • I haven't looked at the downloads yet but you sound like you've looked around a good bit so the only thing I can think of is that you run your service as administrator. This was my problem, it would not send the packets and I got the same error as you, all due to the service not running as administrator. Right click your service -> Properties -> Log On -> Make sure you tick "This account" and then type in the administrator credentials and try it :)