The service acts like a mail watcher on a mail box and is working fine after installing on a new server. But, while stopping it, i get this error message that the
the service cannot accept control messages at this time
and all the ways to kill it didn't work.
It gets stuck at removeSubscription()
as per the logs.
public static void Unsubscribe ()
{
if (_ss.Id.Length>0){
Logger.log("Reached Here");
_connection.RemoveSubscription(_ss);
}
}
Here _ss
is the streamingSubscription, _connection
is streamingSubscriptionConnection references
Can you tell me how to fix it? P.S.: the same service works well on other server.
Well, actually this function used to work really well on the previous server so had not used a try catch block to handle exceptions.
When i logged the exception, it turned out that it threw an error that the connection needs to be closed first. So changed the code to
_connection.close();
_connection.RemoveSubscription();
This solved the issue.