Hello everybody,
I have developed a service following an article from CodeGuru. I see it runs because I can debug it, but I cannot see it from the list of services on my machine.
Does anyone have any idea of the reason? I'm on a Windows 2000 machine.
Re: Can't my service running in the list of services
It is a good idea that when you reference an article that you provide a link to the article. Some of the articles and the ATL wizard for services allow for your code to run without calling the Service API's to install the service. If you did create an ATL wizard app service project then you need to pass -servcie or /service to create the service.
Re: Can't my service running in the list of services
Originally Posted by annalisa1976
Hello everybody,
I have developed a service following an article from CodeGuru. I see it runs because I can debug it, but I cannot see it from the list of services on my machine.
Does anyone have any idea of the reason? I'm on a Windows 2000 machine.
Thank you all,
Annalisa Bacherotti
in the end a service is just an app. If you don't install it the system won't "see" it!
Help me help you ... rate this article if any good!
in Program arguments from Project/Settings, tab Debug, General option, as suggested. I thought it was enough.. Icreated a console program..
What else should I do? It's the first time I do it, I'm quite confused..
Re: Can't my service running in the list of services
Did you call the RegisterService(...) member function? You should probably step into the code under a debugger or zip up your source/headers and post what you have done.
Look at the sample project download from the link.
Re: Can't my service running in the list of services
If it's not in the list of services then it's not installed. Debugging it using the IDE is not running the code "as a service". The service must be registered using the -i option as discussed in the article. You must have missed something somewhere.
Try debuggin it and using the -i option and
1 - Ensure it executes the registration code.
2 - There are no errors returned during registration.
Requests such as
"I need to write an new language compiler by next week, I have teach yourself c++ in 21 days, can someone give me example code?" will be ignored.
Re: Can't my service running in the list of services
Well, guys, another problem occurred now. I hope you will be so kind to keep pn helping me..
When I was trying to debug the app, and simply called the constructor in main.cpp,
the application threw an assert!
So I can't even try to register anymore. I think the assert is thrown because there's more than one instance of the app..
Code:
//my file
#ifdef _CONSOLE
int main( int argc, char ** argv )
{
#else
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) {
int argc = __argc;
char ** argv = __argv;
#endif // _CONSOLE
// create the service-object
CIService serv; //HERE STARTS THE ASSERT!!!!!!!!!!
return serv.RegisterService(argc, argv);
}
Code:
//NTService.h
//HERE THE ASSERT IS THROWN
_ASSERTE( ! m_bInstance );
Do you know a way to discover it? I know it's difficult witout the code, but I can't send it. It doesn't work without some APIs for image recognition. I will try to semplify it at most as I can..
Thank you very very much everybody
Re: Can't my service running in the list of services
Just some clarification.
You can debug a service within the IDE. This is generally a two step process, the first as pointed out is to debug during the creation of the service: CreateService(...) etc.
The second is to debug during the invokation of the service by the SCM. To debug using the IDE use attach to process. There is an issue with < sp6 where services will not be listed in the process task. To get around this pass the service pid to msdev [-p/-e] from the command line or use windbg from msdn.microsoft.com.
If you are debugging the actual startup code then you must be aware that the SCM must be updated periodically with SetServiceStatus(...) or the SCM will time you out.
Re: Can't my service running in the list of services
Originally Posted by annalisa1976
Well, guys, another problem occurred now. I hope you will be so kind to keep pn helping me..
When I was trying to debug the app, and simply called the constructor in main.cpp,
the application threw an assert!
So I can't even try to register anymore. I think the assert is thrown because there's more than one instance of the app..
m_bInstance is static you have more than one instance in your application.
Re: Can't my service running in the list of services
Thank you all.. I think I have to read more docs. meanwhile, I'll try to build a simplified version of my project, so that I can send it attached if needed.
Re: Can't my service running in the list of services
ok, I have written a service from my app that doesn't do anything except sending a message once when it executes. But it gives an assert just at the beginnig.
Anyone can help me?
The problem is born this morning, not before..
Re: Can't my service running in the list of services
You're right.That has fixed the problem about crashing..
Sorry if my mistake has bothered you so much.
Thank you, guys, you've been very kind. Now I'm gonna try to see the name of the service in the service list.
Regards,
Annalisa
Re: Can't my service running in the list of services
Originally Posted by annalisa1976
You're right.That has fixed the problem about crashing..
Sorry if my mistake has bothered you so much.
Thank you, guys, you've been very kind. Now I'm gonna try to see the name of the service in the service list.
Regards,
Annalisa
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.