Why wont my Service stop..Failed to stop service.Appreciate advices

  • Thread starter Thread starter shakthi
  • Start date Start date
S

shakthi

Failed to stop service.
System.ServiceModel.CommunicationObjectFaultedException: The
communication object, System.ServiceModel.ServiceHost, cannot be used
for communication because it is in the Faulted state.
at HRBFA.Agent.WindowsService.AgentWindowsService.OnStop() in C:\tfs
\FA Nexus\Dev\Framework\HRBFA.Agent\HRBFA.Agent.WindowsService
\AgentWindowsService.cs:line 51
at System.ServiceProcess.ServiceBase.DeferredStop()

The OnStop() which i hav is
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary
to stop your service.
try
{
if (serviceHost != null)
{
serviceHost.Close();
serviceHost = null;
}
}
catch (Exception e)
{
throw e;
}
}
 
Failed to stop service.
System.ServiceModel.CommunicationObjectFaultedException: The
communication object, System.ServiceModel.ServiceHost, cannot be used
for communication because it is in the Faulted state.
   at HRBFA.Agent.WindowsService.AgentWindowsService.OnStop() in C:\tfs
\FA Nexus\Dev\Framework\HRBFA.Agent\HRBFA.Agent.WindowsService
\AgentWindowsService.cs:line 51
   at System.ServiceProcess.ServiceBase.DeferredStop()

The OnStop() which i hav is
  protected override void OnStop()
        {
            // TODO: Add code here to perform any tear-down necessary
to stop your service.
            try
            {
                if (serviceHost != null)
                {
                    serviceHost.Close();
                    serviceHost = null;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }

figured it out...thankx
 
It is customary and polite, when you figure out the answer to your own  
question, to post that answer to the newsgroup.

Just because there wasn't someone else in the newsgroup who could answer  
the question as stated, that doesn't mean that your own answer won't help 
someone with a similar problem in the future.

Pete

actullay if i knw the answer i wud i hav posted it, but i dono wat i
did..bocz i jst went throught lot of stuff in my code and dono which
part exactly made that error disappear:(
 
Back
Top