Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
1. I have a client server application that uses C# service to communicate with clients. Communication is done using single TCP port.
2. Now I updated this C# service code to use an additional TCP port for better communication with clients.
3. This new C# service works smoothly on fresh installation but on application upgrade case this C# service does not communicate using the new port. To solve this problem I have to restart the C# service to start communication on new port.I wonder whether this issues is related the newly port added to C# service.
How can I enable c# service to start communication using new port after upgrade without any service restart.

During upgrading of application I stop the service replace the exe and start it again but this does not solve the problem. After complete upgradation of application I have to Restart the service.
Posted
Updated 9-Jul-15 21:12pm
v2
Comments
Sergey Alexandrovich Kryukov 9-Jul-15 11:23am    
Not enough information. First idea which comes to mind: checkup the firewall data. If this is a problem, add the fix to the installation.
—SA
joje1985 10-Jul-15 3:13am    
Service is in exception firewall and it can access any ports.
Richard MacCutchan 9-Jul-15 11:39am    
The running service does not get changed by the upgrade process, it needs to stop and be restarted to run the new code.
joje1985 10-Jul-15 3:14am    
after the complete upgrade Service is started but still it does not communicate using second port. Instead I have to restart server service to enable communication on new port.
Richard MacCutchan 10-Jul-15 3:58am    
Sounds logical.

Could be your upgrade is just too fast. In my experience with services, they often report to have stopped but actually you need to wait a little longer before you can change anything about the service.
For example, in a command script this will fail because execution is too fast:
sc stop MyService
... do something with the service
sc start MyService


It isn't very clear how you do your upgrade but this could easily be the problem. Otherwise, please provide more info.

Good luck!
 
Share this answer
 
Thank you guys :)

I solved the problem by restarting the service after upgrading with a delay of 3 mins after upgrade.

Also I noted that after upgrading this new service would take a long time to stop, sometimes I had to kill the service process and then start the service again.

But after starting service again it would start communicating using new port and work smooth as butter.... :P
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900