简体   繁体   中英

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?

In my case, the same application core running in a console application (working OK) was not working as windows service (TCP communication problems).

Diagnostic: there were some nuget packages missing in windows service project. Those nuget packages already been installed for console application project.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM