Windows Service

  • Thread starter Thread starter C#User
  • Start date Start date
C

C#User

i wrote a Windows Service program (myService) for testing. OnStart: just
create a new file in my directory.

Everything seems fine. But when i open the Services Panel, try to start the
myService, it pops up the following message:

"The myService service on Local Computer started and then stopped. Some
services stop automatically if they have no work to do, for example, the
Performance Logs and Alerts service."

And the file failed to create.

Any idea?

Thanks.
 
Have you tried attaching a debugger to the service and steped through the
execution?

--
Jared Parsons [MSFT]
(e-mail address removed)
This posting is provided "AS IS" with no warranties, and confers no rights.
OR if you wish to include a script sample in your post please add "Use of
included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"
 
C#User said:
i wrote a Windows Service program (myService) for testing. OnStart: just
create a new file in my directory.

Everything seems fine. But when i open the Services Panel, try to start the
myService, it pops up the following message:

"The myService service on Local Computer started and then stopped. Some
services stop automatically if they have no work to do, for example, the
Performance Logs and Alerts service."

And the file failed to create.

Any idea?

You're not in the directory that you think you're in.

The service is starting up with a current directory that's in the Windows
SystemRoot (I think it's %SystemRoot%\System32). The file is probably being
created and then the service exits.
 
Hi C#User,

Does the community's reply make sense to you?

Please feel free to feedback, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
It is due to an error within your Windows Service class. Check the Event
Log and you will know the error. Correct the exception and your Windows
Service will run properly.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
Back
Top