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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shakthi

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

    Failed to stop service.
    System.ServiceM odel.Communicat ionObjectFaulte dException: The
    communication object, System.ServiceM odel.ServiceHos t, cannot be used
    for communication because it is in the Faulted state.
    at HRBFA.Agent.Win dowsService.Age ntWindowsServic e.OnStop() in C:\tfs
    \FA Nexus\Dev\Frame work\HRBFA.Agen t\HRBFA.Agent.W indowsService
    \AgentWindowsSe rvice.cs:line 51
    at System.ServiceP rocess.ServiceB ase.DeferredSto p()

    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.Clo se();
    serviceHost = null;
    }
    }
    catch (Exception e)
    {
    throw e;
    }
    }
  • shakthi

    #2
    Re: Why wont my Service stop..Failed to stop service.Appreci ateadvices

    On Oct 22, 10:52 am, shakthi <shakth...@gmai l.comwrote:
    Failed to stop service.
    System.ServiceM odel.Communicat ionObjectFaulte dException: The
    communication object, System.ServiceM odel.ServiceHos t, cannot be used
    for communication because it is in the Faulted state.
       at HRBFA.Agent.Win dowsService.Age ntWindowsServic e.OnStop() in C:\tfs
    \FA Nexus\Dev\Frame work\HRBFA.Agen t\HRBFA.Agent.W indowsService
    \AgentWindowsSe rvice.cs:line 51
       at System.ServiceP rocess.ServiceB ase.DeferredSto p()
    >
    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.Clo se();
                        serviceHost = null;
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
    figured it out...thankx

    Comment

    • Peter Duniho

      #3
      Re: Why wont my Service stop..Failed to stop service.Appreci ateadvices

      On Thu, 30 Oct 2008 12:55:26 -0700, shakthi <shakthi.N@gmai l.comwrote:
      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

      Comment

      • shakthi

        #4
        Re: Why wont my Service stop..Failed to stop service.Appreci ateadvices

        On Oct 30, 3:08 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
        wrote:
        On Thu, 30 Oct 2008 12:55:26 -0700,shakthi<sh akth...@gmail.c omwrote:
        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:(

        Comment

        Working...