Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sun, 6 Apr 2008 22:23:00 -0700,    group: microsoft.public.dotnet.security        back       


Unable to start service register   
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 Shah
date: Sun, 6 Apr 2008 22:23:00 -0700   author:   ROMIL

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us