Windows Service

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.
 
J

Jared Parsons [MSFT]

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"
 
J

John Vottero

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.
 
J

Jeffrey Tan[MSFT]

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.
 
R

Ravichandran J.V.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top