-
January 6th, 2010, 06:59 AM
#1
COM Service Startup issues on startup
hello,
i am working on the application where i have developed COM logger service for centralized logging. i register the COM Server (Out of process ) as service
so that when a application 1 ( Service ) and application 2 ( desktop app ) logs there will be one single instance of COM logger. this all works well,
however i recently discovered that on reboot. when i login into system. my application 1( service ) takes a long time to run. i debugged it and then with some tracing i came to know that since my service needs logging. on startup it tires to create the logger object through
CoCreateInstance()
HRESULT hr = ::CoCreateInstance( __uuidof(LoggerFactory), NULL, CLSCTX_LOCAL_SERVER,
__uuidof(ILoggerFactory), (void **)&pLoggerFacTry );
this calls takes a long time to start about 2 minutes.
does any body have idea how to fix this problem.
regards
Deepak
-
January 6th, 2010, 11:18 AM
#2
Re: COM Service Startup issues on startup
When you register a Windows services, you can define other services as startup dependencies. The OS will then be sure to start up the services in the proper order.
What I believe is happening is that your Service is attempting to use the LoggingService, but it hasn't been started yet.
Btw, is your out of proc LoggingService hosted by a Windows Service? If it isn't, I suggest you make it one (rather than simply an out of proc exe server).
-
January 8th, 2010, 06:23 AM
#3
Re: COM Service Startup issues on startup
hello Arjay,
thanks for your reply.
here is what is happening. there is a service application which on startup tries to create the COM logger service instance. COM logger service startup type was "Manual". then i thought that lets change its (COM logger ) service startup type to "automatic". i also placed some trace comments.
on PreMessageLoop() of COM logger service to see if it is starting properly.
PreMessageLoop Enter
PreMessageLoop Exit
i can see both messages in the debug view. meaning the COM logger service has started. but i see a long delay. when service application calls
CoCreateInstance of Logger.
i have not set any dependency in the SCM. do you think for just logger service i should add dependency why it is not able to find it out at system startup
it starts COM logger serivice almost instantly when system is up. but not at widnows startup.
this delay is causing my service application to wait for almost 90 seconds. which is bad.
and since the Service application is waiting for COM logger service to provide COM Logger Object. the status of my Service application is "starting"
in service control manager.
can it be some configuration issues. i have set CoinitializeSecurity(). to make is NULL for both services.
HKCR
{
NoRemove AppID
{
ForceRemove {8EA1C7D0-71EA-48EA-8C7F-E1400B53B2AF} = s 'MYCOMLogger'
{
val LocalService = s 'MYCOMLogger'
val ServiceParameters = s '-Service'
}
}
}
HKCR
{
MYCOMLogger.MYLoggerFactory.1 = s 'MYLoggerFactory Class'
{
CLSID = s '{AF7CE0BD-026A-4388-8431-339F10E989C0}'
}
MYCOMLogger.MYLoggerFactory = s 'MYLoggerFactory Class'
{
CLSID = s '{AF7CE0BD-026A-4388-8431-339F10E989C0}'
CurVer = s 'MYCOMLogger.MYLoggerFactory.1'
}
NoRemove CLSID
{
ForceRemove {AF7CE0BD-026A-4388-8431-339F10E989C0} = s 'MYLoggerFactory Class'
{
val AppID = s '{8EA1C7D0-71EA-48EA-8C7F-E1400B53B2AF}'
ProgID = s 'MYCOMLogger.MYLoggerFactory.1'
VersionIndependentProgID = s 'MYCOMLogger.MYLoggerFactory'
ForceRemove 'Programmable'
LocalServer32 = s '%MODULE%'
'TypeLib' = s '{1DD2CFCF-0A5C-465E-BAB5-B654C9A7AE5E}'
}
}
}
HRESULT hr = CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,
RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_NONE, NULL );
regards
deepak
-
January 8th, 2010, 06:26 AM
#4
Re: COM Service Startup issues on startup
hello arjay.
the COM logger service is a Windows service. if you remember we had a good discussion about centralized logging before.
Untill now it worked as expected. but this startup issue is a big trouble
regards
Deepak
-
January 8th, 2010, 12:06 PM
#5
Re: COM Service Startup issues on startup
I kind of remember our discussion, but I had forgot whether the logging service was contained within a windows service (or just in a standalone COM server exe).
Since the logging service is hosted by a windows service, set the startup dependency of the consuming service to the logging service.
Windows will then ensure your logging service is started before the consuming service.
-
January 16th, 2010, 01:57 PM
#6
Re: COM Service Startup issues on startup
hello Arjay
you and some other guy at MS pointed me at right direction. it was essentially that the COM logger service has not started. i had to set dependency to both my application in the SCM that SCM should start the COM logger service as well.
and it worked as expected.
thanks you very much
Regards
Deepak
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|