How to keep COM object alive in .NET windows service?

I have created windows service which instantiates COM object in OnStart event of the service. While the service OnStart is in process, I can see the COM EXE in running processes (in task manager) but once the service is completely started, the COM instance gets destroyed. I googled on this in which I got an answer to implement STA thread process to instantiate COM object. But after implementing threading, I now get error as "Retrieving the COM class factory for component with CLSID {D66B3D9C-D465-46B8-BFB4-F63F04FB203C} failed due to the following error: 80080005."

Please help me out...
yatinganeshAsked:
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.

Anurag ThakurTechnical ManagerCommented:
to implement STA in windows service have a look at the foloowing sample
http://discuss.joelonsoftware.com/default.asp?dotnet.12.459213.6
0
Anurag ThakurTechnical ManagerCommented:
the above link might throw an exception on stop i suppose...
there was one more link for Using COM Interop on a Single Threaded Apartment from a Windows Service on EE
http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_Studio_.NET_2005/Q_23058828.html
0
yatinganeshAuthor Commented:
We found that the COM component we were using was expired. We brought the licensed copy and now it works fine even without threading. Apology for the trouble.
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
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
C#

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.