Search code examples
c#windows-7servicetcpsocketexception

C# Windows Service which acts as TCP server refuses connection under Windows 7


I'm working on a simple pair of TCP server and client, which are running on the same machine. As long as the server runs as ordinary executable, everything works. But as soon as I deploy the server as Windows service the client keeps getting SocketExecption stating "No connection could be made because the target machine actively refused it 127.0.0.1:6692".

I am fairly new to Windows 7, but I assume that there are some security restriction I am not aware of. Test wise I already deactivated the virus scanner as well as the firewall, which changed nothing.

Could anyone give me an hint?


Solution

  • 1) Make sure that the service is actually running, that it did not stop after started. 2) Change the user under which the service is running (4ex to Local System)