Jump to content
Forum²

Recommended Posts

Posted

Hi,

 

I am facing problem in starting an application registered as a service on Windows 2008 server.

 

Given below are the details steps :

 

Code snippet used to register a service :

 

// Open a connection to the service control manager on

// the local machine.

srvManager = OpenSCManager( NULL,

NULL,

SC_MANAGER_ALL_ACCESS

);

 

// If can't get a connection, we have to return.

if (srvManager == NULL) {

Debug(LDAP_DEBUG_TRACE,

"getCurrentProcessSID: OpenSCManager failed errno=%d.\n",

GetLastError());

return ldtr_rc(LDAP_OPERATIONS_ERROR);

}

 

 

dwStartType = SERVICE_AUTO_START;

 

 

// Now try to create the service.

ptrService = CreateService(

// pointer to the service control manager.

srvManager,

// The name of the service.

service_name,

// The display name description of the service.

description,

SERVICE_ALL_ACCESS,

SERVICE_WIN32_OWN_PROCESS,

// If the service is auto started or now.

dwStartType,

SERVICE_ERROR_NORMAL,

// The command to run and parameters to pass it.

command,

NULL,

NULL,

NULL,

// The user id to run the service under.

userid,

// The password of the id to run the service under.

password);

 

Value of the parameter passed to the above mentioned function is :

command : c:\diradm.cmd --> script used in to invoke the require binary .

userid : NULL

Password : NULL

Service name : diradm_xyz

description: Service used to start the server

 

On running this piece of code , I see a service registered under Administrator -> Services

 

I tried to run the service from the Services panel , but I see the error on the console as :

 

Error 1053, The service did not responded to the start or control request in a timely fashion . I have debug statement in the diradmd.cmd file which should be redirected to a log file.

It seems that diradm.cmd is not called by service registered !

 

The strange part is that the same piece of code works fine on Windows 2003 server so what I am missing for Windows 2008 ?

Note in case of Win 2003 , I have set the dependency on Lan Manager and here I have passes it as NULL.

 

Looking forward for your suggestion ,

 

Thanks,

Romil

  • Forum² Admin
Posted

There is a difference in the way services are handled. Services that would install and run on 2003 don't work on 2008. I haven't had a chance to look deeper into the difference. I really should take the time because I know this type of problem will hit me when I start to migrate clients from 2003 to Windows 2008 Server.

Please post what you find and I will do the same.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...