Event ID: 7022, service hung on starting

Hi,

I try to create a windows service so my program will be run during the boot time.  Now I got this event message, "Event ID: 7022....The Server service hung on starting".  How can I debug to figure where exactly it is incorrect to cause this problem?  Any suggestion?  What will cause this problem??

Help please~~~


Xenia
xenia27Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xenia27Author Commented:
How can I simple stop this event message not showing when I boot my computer????
Any suggestion?  How can I fix it???
0
jkrCommented:
When your service is starting, you need to report appropriate wait hints to the SCM and increase the dwCheckPoint member in your SERVICE_STATUS if the startup is a lengthy operation. And, you need to signal SERVICE_RUNNING at the end of the startup, e.g.

SERVICE_STATUS ssStatus;

    ssStatus.dwCurrentState      =      SERVICE_RUNNING;
    ssStatus.dwWin32ExitCode      =      0;
    ssStatus.dwWaitHint            =      0;

    // 'myStatusHandle' is returned by 'RegisterServiceCtrlHandler()'
    SetServiceStatus ( myStatusHandle, &ssStatus);





0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xenia27Author Commented:
I try this in my code...but not working...when I reboot, the message show still...
What should I do?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

jkrCommented:
>>What should I do?

Use a log file to track what your service is doing on startup. BTW, no need to reboot, you can just start/stop the service from the control panel.
0
xenia27Author Commented:
I cannot choose start/ stop the service through the control panel...the options are enabled.  What should I do?  What should I change while I set up my service???
0
xenia27Author Commented:
SERVICE_STATUS ssStatus;

    ssStatus.dwCurrentState     =     SERVICE_RUNNING;
    ssStatus.dwWin32ExitCode     =     0;
    ssStatus.dwWaitHint          =     0;

    // 'myStatusHandle' is returned by 'RegisterServiceCtrlHandler()'
    SetServiceStatus ( myStatusHandle, &ssStatus);

this actually work...but I put them into the wrong place...anyway, now it's working!!!  But I wonder why I cannot stop or start through the control panel...any idea???
0
nfulfordCommented:
I had the same problem with the server services not starting which was making the PC hand for about 15 minutes when logging in.

the cause of this was a new printer share!  Once i unshared the printer it was OK again.

Nick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.