By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Installing C-Sharp services in Windows

P: n/a
Hi,

I am creating a Window Service in C-Sharp. The Window Service has a
reference to an OCX file created in VC++. In OnStart method I have created
an instance of the class, of the OCX file and called a method of the class.
Compilation was successful.

I created a Windows installer setup(.MSI), for installing the service. The
installation was successful. I started my service from the Services
Management Console. It started and stopped immediately, throwing the below
Exception in the System Application Log:
__________________________________________________ _____
Service cannot be started. System.Runtime.InteropServices.COMException
(0x8000FFFF): Catastrophic failure
at System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at FOCCLib.FOCCClass.Connect(String serverAddr, String port)
at WindowsService1.Service1.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMai nCallback(Object
state)
__________________________________________________ _____

Please help me in resolving this issue.

Thanks in advance,
Jeevan
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Jeevan" <jn******@annetsite.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

I am creating a Window Service in C-Sharp. The Window Service has a
reference to an OCX file created in VC++. In OnStart method I have created
an instance of the class, of the OCX file and called a method of the
class. Compilation was successful.

I created a Windows installer setup(.MSI), for installing the service. The
installation was successful. I started my service from the Services
Management Console. It started and stopped immediately, throwing the below
Exception in the System Application Log:
__________________________________________________ _____
Service cannot be started. System.Runtime.InteropServices.COMException
(0x8000FFFF): Catastrophic failure
at System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at FOCCLib.FOCCClass.Connect(String serverAddr, String port)
at WindowsService1.Service1.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMai nCallback(Object
state)
__________________________________________________ _____

Please help me in resolving this issue.

Thanks in advance,
Jeevan


OCX objects have special requirements not fullfilled when instantiated from
Windows Services.
1. They need an STA apartment to live in, Windows Services threads are MTA
by default.
2. They need a ActiveX container as a host - for instance a Windows Form,
Windows Services don't/shouldn't provide such container as they should be
designed to run without a UI.

Or simply stated, don't try to use OCX's in non interactive applications.

Willy.
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.