473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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

Failed to stop service.
System.ServiceModel.CommunicationObjectFaultedExce ption: The
communication object, System.ServiceModel.ServiceHost, cannot be used
for communication because it is in the Faulted state.
at HRBFA.Agent.WindowsService.AgentWindowsService.OnS top() in C:\tfs
\FA Nexus\Dev\Framework\HRBFA.Agent\HRBFA.Agent.Window sService
\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;
}
}
Oct 22 '08 #1
3 4197
On Oct 22, 10:52*am, shakthi <shakth...@gmail.comwrote:
Failed to stop service.
System.ServiceModel.CommunicationObjectFaultedExce ption: The
communication object, System.ServiceModel.ServiceHost, cannot be used
for communication because it is in the Faulted state.
* *at HRBFA.Agent.WindowsService.AgentWindowsService.OnS top() in C:\tfs
\FA Nexus\Dev\Framework\HRBFA.Agent\HRBFA.Agent.Window sService
\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
Oct 30 '08 #2
On Thu, 30 Oct 2008 12:55:26 -0700, shakthi <sh*******@gmail.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
Oct 30 '08 #3
On Oct 30, 3:08*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Thu, 30 Oct 2008 12:55:26 -0700,shakthi<shakth...@gmail.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
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:(
Oct 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ross Bennett | last post by:
Ahoy, Folks! I've been looking all over for this, but I just can't seem to shake any documentation out of the MSDN or from Google. I've reviewed every .NET article on developing Windows...
4
by: Keith | last post by:
I'm in the same boat as the fellow who posted this message back in August: Title : Windows Service, How does one make a service "fail" properly? Author : Ross Bennett Group :...
7
by: BW | last post by:
Hi all! I'm not sure where to post this so I'm giving these a try. If there is a better (more appropriate) place to post please let me know. I want to create a service (in C#). The service's...
12
by: JSheble | last post by:
I've written a Windows Service using C#, but I cannot seem to figure out how to cancel or prevent the service from starting under certain conditions. For example, in the OnStart I read in some...
3
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with...
4
by: SQLScott | last post by:
My esteemed VB.Net gurus, I posted this question a week or so ago and recieved 1 response that helped me somewhat but really did not solve the problem (but I do appreciate the response). I...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
3
by: Smithers | last post by:
I'm writing a new Windows Service. During the OnStart event procedure I initialize a few things. If initialization fails, then I do not want for the service to start. What I currently have is...
8
by: Lemune | last post by:
Hi, I'm developing window service application on C# 2005. The service is to read a new excel file on certain directory, and process it to database. The service work find on XP. But when I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.